-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
42 lines (32 loc) · 1.01 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
FROM node:16-alpine as build-step
#RUN mkdir -p /app
WORKDIR /usr/local/app
COPY package.json /usr/local/app
COPY .npmrc /usr/local/app
RUN npm install -f
COPY . /usr/local/app
#RUN npm run build --prod
# Generate the build of the application
ARG ZXBILD="prod" #default argument when not provided in the --build-arg
RUN echo $ZXBILD
RUN if [ "$ZXBILD" = "prod" ] ; then \
npm run build; fi
RUN if [ "$ZXBILD" = "dev" ] ; then \
npm run build; fi
RUN if [ "$ZXBILD" = "qa" ] ; then \
npm run build; fi
RUN if [ "$ZXBILD" = "demo" ] ; then \
npm run build; fi
RUN if [ "$ZXBILD" = "fcc" ] ; then \
npm run build; fi
RUN if [ "$ZXBILD" = "gfl" ] ; then \
npm run build; fi
# Stage 2: Serve app with nginx server
# Use official nginx image as the base image
#FROM nginx:1.17.1-alpine
FROM nginx:latest
COPY nginx.conf /etc/nginx/nginx.conf
# Copy the build output to replace the default nginx contents.
COPY --from=build-step /usr/local/app/dist/demo /usr/share/nginx/html
# Expose port 80
EXPOSE 80