-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
64 lines (59 loc) · 1.56 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
## 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
# This is local build flow
#FROM node:18 AS BUILD_IMAGE
#FROM nginx:alpine
#RUN pwd
#RUN ls -l
#WORKDIR /etc/nginx/
#RUN pwd
#RUN ls -l
#RUN cat nginx.conf
#RUN rm nginx.conf
#COPY nginx.conf .
#RUN cat nginx.conf
FROM node:18 AS BUILD_IMAGE
WORKDIR /app
COPY . .
RUN npm install
RUN node_modules/.bin/ng build --configuration production
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