Dockerfile 561 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# This Dockerfile uses a multi-stage build. Only the first stage requires
# all dependencies, the final image will contain only the output files

# First stage: Build project
FROM node as build

# Copy files and install dependencies
COPY ./ /
RUN npm install
RUN npm audit fix

# Build project
RUN npm run build


# Second stage: Server to deliver files
FROM nginx:1.15-alpine

# Copy files from first stage
COPY --from=build /index.html /var/www/
COPY --from=build /dist /var/www/dist

# Copy nginx configuration
COPY nginx.conf /etc/nginx/conf.d/default.conf