-
Notifications
You must be signed in to change notification settings - Fork 11
/
Dockerfile
40 lines (30 loc) · 1.48 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# base image
FROM node:16 AS BUILD_IMAGE
# set working directory
WORKDIR /app
# install angular cli
RUN npm install -g @angular/cli
# clone & install deps for repo
ARG branch=develop
ARG node_explorer_git="https://github.com/tezedge/tezedge-explorer"
RUN git clone ${node_explorer_git} && \
cd tezedge-explorer && \
git checkout ${branch} && \
npm install --save --legacy-peer-deps
# change dir to angular app
WORKDIR /app/tezedge-explorer
# buid app
RUN ng build --configuration production --output-path=/dist
# remove development dependencies
RUN npm prune --production --legacy-peer-deps
################
# Run in NGINX #
################
FROM nginx:alpine
COPY --from=BUILD_IMAGE /dist /usr/share/nginx/html
ARG commit=local
ENV COMMIT=$commit
# When the container starts, replace the env.js with values from environment variables
CMD ["/bin/sh", "-c", "envsubst < /usr/share/nginx/html/assets/env.template.js > /usr/share/nginx/html/assets/env.js && exec nginx -g 'daemon off;'"]
# Example of how to run
# docker run --env SANDBOX='https://carthage.tezedge.com:3030' --env API='[{"id":"master","name":"master.dev.tezedge","http":"http://master.dev.tezedge.com:18733","monitoring":"http://master.dev.tezedge.com:38733/resources/tezedge","debugger":"http://master.dev.tezedge.com:17733","ws":false,"features":["MONITORING", "RESOURCES", "MEMPOOL_ACTION", "STORAGE_BLOCK", "NETWORK_ACTION", "LOGS_ACTION"],"resources":["system","storage","memory"]}]' -p 8080:80 tezedge-explorer:latest