-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
60 lines (41 loc) · 1.33 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
###################
# BUILD FOR DEVELOPMENT
###################
FROM node:18 As build
# Set the working directory
WORKDIR /usr/src/app/frontend
# Add the node_modules to the PATH
ENV PATH ./node_modules/.bin:$PATH
# Copy the package.json and package-lock.json to install dependencies
COPY package*.json ./
# Copy the production environment variable file
COPY ./prod.front.env ./
# Install all the dependencies
RUN npm ci
# Add the source code to app/frontend
COPY . .
# Generate the build of the application
RUN npm run build
# Set the environment variables
ARG NODE_ENV=production
ENV NODE_ENV ${NODE_ENV}
###################
# BUILD FOR PRODUCTION
###################
FROM nginx:latest As production
# Copy the build output to replace the default nginx contents.
COPY --from=build /usr/src/app/frontend/build /usr/share/nginx/html
# Copy the local nginx configuration file to the nginx conf.d folder
COPY nginx/default.conf /etc/nginx/conf.d/default.conf
# Copy the package.json and package-lock.json
COPY --from=build /usr/src/app/frontend/package*.json ./
# Copy the production environment variable file
COPY --from=build /usr/src/app/frontend/prod.front.env ./
# Copy the nginx access file
# COPY nginx/.access /etc/nginx/.access
# Expose port 80
EXPOSE 80
# Expose port 443
EXPOSE 443
# Run nginx
CMD [ "nginx", "-g", "daemon off;" ]