-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
35 lines (27 loc) · 1 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
# Builder stage
FROM node:20-bookworm AS builder
ENV PNPM_HOME="/pnpm"
ENV PATH="/pnpm:$PATH"
RUN corepack enable
WORKDIR /builder/
COPY ./package.json ./pnpm-lock.yaml ./
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install
COPY . ./
RUN pnpm run build
# Runner stage
FROM node:20-bookworm-slim AS runner
ENV NODE_ENV=production \
NODE_PORT=3024 \
PROCESS_VERSION_MODULES=115
EXPOSE 3024
WORKDIR /app/
ENV NODE_ENV=production
# Copying all necessary files from the builder stage
COPY --from=builder /builder/node_modules/uWebSockets.js/package.json \
/builder/node_modules/uWebSockets.js/uws_linux_x64_${PROCESS_VERSION_MODULES}.node \
/builder/node_modules/uWebSockets.js/uws_linux_arm64_${PROCESS_VERSION_MODULES}.node \
/builder/node_modules/uWebSockets.js/uws.js \
/app/node_modules/uWebSockets.js/
COPY --from=builder /builder/node_modules/bufferutil /builder/node_modules/bufferutil
COPY --from=builder /builder/dist/bundle.js /app/dist/bundle.js
CMD ["node", "dist/bundle.js"]