-
Notifications
You must be signed in to change notification settings - Fork 33
/
Dockerfile
35 lines (25 loc) · 1.02 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
# Multistage build
# 1. Stage: Build the app
FROM node:20-alpine as build-stage
WORKDIR /opt/client/
# System deps and app setup:
RUN apk --no-cache add 'build-base>=0.5' 'git>=2.38' \
&& npm install -g 'pnpm@^9'
# Add diretories with necessary config files
COPY pnpm-lock.yaml package.json /opt/client/
# Only install production.
RUN pnpm install --only=prod
COPY build /opt/client/build
COPY src /opt/client/src
COPY config /opt/client/config
COPY .eslintignore pnpm-lock.yaml cypress.config.js .babelrc .eslintrc.js dev.html package.json .postcssrc.js /opt/client/
RUN pnpm build
# 2. Stage: Start server with needed files only
FROM nginx:stable-alpine as production-stage
RUN apk add --no-cache 'openssl>=3.0' 'bash>=5.1' \
&& rm -rf /usr/share/nginx/html/*
USER nginx
COPY --from=build-stage /opt/client/static /usr/share/nginx/html/static
COPY --from=build-stage /opt/client/index.html /usr/share/nginx/html/
COPY templates/nginx.ors-map-client.conf.nginx /etc/nginx/conf.d/default.conf
CMD ["nginx", "-g", "daemon off;"]