-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
27 lines (21 loc) · 918 Bytes
/
Dockerfile
File metadata and controls
27 lines (21 loc) · 918 Bytes
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
FROM node:24-alpine AS builder
WORKDIR /usr/local/app
RUN apk add pnpm
COPY . .
RUN pnpm install --ignore-scripts
RUN pnpm prepare
RUN pnpm run build
# Delete node_modules that contain dev deps and only install runtime deps
# in the version that is copied to the final output
RUN rm -rf node_modules/
RUN pnpm install -P --ignore-scripts
FROM gcr.io/distroless/nodejs20-debian12:debug-nonroot
COPY --from=builder --chown=nonroot:nonroot --chmod=777 /usr/local/app/dist /app/dist/
COPY --from=builder --chown=nonroot:nonroot --chmod=555 /usr/local/app/node_modules /app/node_modules
COPY --from=builder --chown=nonroot:nonroot --chmod=444 /usr/local/app/package*.json /app/
COPY --from=builder --chown=nonroot:nonroot --chmod=555 /usr/local/app/server.js /app/
WORKDIR /app
ENV NODE_ENV=production
ENV PORT=8080
EXPOSE 8080
ENTRYPOINT ["sh", "-c", "/busybox/sh ./dist/vite-envs.sh && /nodejs/bin/node server.js"]