-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDockerfile-prod
More file actions
33 lines (24 loc) · 891 Bytes
/
Dockerfile-prod
File metadata and controls
33 lines (24 loc) · 891 Bytes
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
#Based on the template from niployments (https://github.com/NIAEFEUP/niployments) for react applications
# First, building the static files
FROM node:14.18.3-alpine as build
WORKDIR /usr/src/app
COPY package.json package-lock.json ./
# Because colors break logs
ENV NPM_CONFIG_COLOR=false
# Production or not doesn't really matter as this image will not be used other than for building
RUN npm install
# Necessary files for building the app
COPY public/ public/
COPY config/ config/
COPY scripts/ scripts/
COPY src/ src/
# Copy env files
COPY .env* ./
# Building the image
RUN npm run build
# Then, use nginx to serve the built files
# See https://hub.docker.com/_/nginx
FROM nginx:alpine
# Copying the built files into the nginx image, to the default served directory
COPY --from=build /usr/src/app/build /usr/share/nginx/html
COPY nginx.nijobs.conf /etc/nginx/conf.d/default.conf