-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
29 lines (22 loc) · 978 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
# build environment
FROM --platform=$BUILDPLATFORM node:22-alpine AS build
RUN apk add --no-cache brotli openssl bash grep git openssh-client moreutils
WORKDIR /app
# only copy package.json and package-lock.json to use docker cache for node_modules
COPY package.json package-lock.json ./
RUN npm ci
# copy source files and config files and build
COPY public ./public/
COPY src ./src/
COPY tsconfig.json webpack.config.cjs ./
RUN npm run build
# perform static compression (gzip and brotli)
RUN parallel-moreutils gzip -9k -- $(find build -type f -print0 | xargs -0) && parallel-moreutils brotli -Zk -- $(find build -type f -print0 | xargs -0)
# production environment
FROM fholzer/nginx-brotli:mainline-latest
COPY --from=build /app/build /usr/share/nginx/html
RUN chown -R nginx:nginx /usr/share/nginx/html/
COPY deploy/nginx.conf /etc/nginx/conf.d/default.conf
COPY deploy/security*.conf /etc/nginx/
COPY deploy/ssl/* /etc/nginx/ssl/
COPY deploy/server.conf /etc/nginx/