-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
39 lines (26 loc) · 962 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
35
36
37
38
# Use official node image as the base image
FROM --platform=$BUILDPLATFORM node:16-slim AS build
# Set the working directory
WORKDIR /usr/local/app
# Add dependencies manifest to app
COPY package.json package-lock.json ./
# Install all the dependencies
RUN --mount=type=cache,target=/usr/local/app/.npm \
npm set cache /usr/local/app/.npm && \
npm install
# Add the source code to app
COPY . .
# Generate the build of the application
RUN npm run build
# Stage 2: Serve app with nginx server
# Use official nginx image as the base image
FROM nginx:1.23.3
# Copy the build output to replace the default nginx contents
COPY --from=build /usr/local/app/dist/clean /usr/share/nginx/html
# Copy the nginx config file, which has a try_files rule for SPA routing
COPY nginx/default.conf /etc/nginx/conf.d/default.conf
# Run our envloader script before starting NGINX
COPY entrypoint.sh /entrypoint.sh
CMD [ "/entrypoint.sh" ]
# Expose port 80
EXPOSE 80