forked from tezedge/tezedge-explorer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
41 lines (31 loc) · 1.31 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
41
# base image
FROM node:latest AS BUILD_IMAGE
# set working directory
WORKDIR /app
# install angular cli
RUN npm install -g @angular/cli@10.1.0
# clone & install deps for repo
ARG branch=develop
ARG node_explorer_git="https://github.com/simplestaking/tezedge-explorer"
RUN git clone ${node_explorer_git} && \
cd tezedge-explorer && \
git checkout ${branch} && \
npm install && \
node path.js
# change dir to angular app
WORKDIR /app/tezedge-explorer
# buid app
RUN ng build --prod --output-path=/dist
# remove development dependencies
RUN npm prune --production
################
# 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}]' -p 8080:80 tezedge-explorer:latest