generated from cepdnaclk/eYY-3yp-project-template
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
34 lines (25 loc) · 794 Bytes
/
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
FROM node:16-alpine3.16 as build
WORKDIR /code
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY package*.json ./
# Install dependancies
RUN npm ci
# Copy source files
COPY . .
# Get the passed backend api FQDN
ARG REACT_APP_USE_MOCK_API
ARG REACT_APP_ICE_CONFIGURATION
# Set the backend url before build
ENV REACT_APP_USE_MOCK_API $REACT_APP_USE_MOCK_API
ENV REACT_APP_ICE_CONFIGURATION $REACT_APP_ICE_CONFIGURATION
# Build the project
RUN npm run build
# Nginx webserver
FROM nginx:1.21-alpine as prod
# Get the build artifacts from previous stage
COPY --from=build /code/build /usr/share/nginx/html
# Copy nginx configurations
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD [ "nginx","-g","daemon off;" ]