-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile2
50 lines (48 loc) · 1.49 KB
/
Dockerfile2
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
42
43
44
45
46
47
48
49
50
## base image
#FROM node:18 AS BUILD_IMAGE
#
## set working directory
#WORKDIR /app
#
## install angular cli
#RUN npm install -g @angular/cli
#
## clone & install deps for repo
#ARG branch=local
#ARG node_explorer_git="https://github.com/name-placeholder/mina-frontend"
#RUN git clone ${node_explorer_git} && \
# cd mina-frontend && \
# git checkout ${branch} && \
# npm install
#
## change dir to angular app
#WORKDIR /app/mina-frontend
#
## buid app
#RUN ng build --configuration production --output-path=/dist
#
## remove development dependencies
#RUN npm prune --production
#
#################
## Run in NGINX #
#################
#FROM nginx:alpine
#COPY --from=BUILD_IMAGE /app/dist/mina-frontend /usr/share/nginx/html
#
## 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 ENV='' -p 8080:80 mina-frontend:latest
FROM node:18 AS BUILD_IMAGE
WORKDIR /app
COPY . .
RUN npm install
RUN node_modules/.bin/ng build --configuration cyp
RUN npm prune --production
FROM nginx:alpine
RUN pwd
RUN ls -l
COPY --from=BUILD_IMAGE /app/dist/mina-frontend /usr/share/nginx/html
COPY --from=BUILD_IMAGE /app/nginx.conf /etc/nginx/nginx.conf
#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;'"]