-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdockerfile
More file actions
27 lines (25 loc) · 910 Bytes
/
Copy pathdockerfile
File metadata and controls
27 lines (25 loc) · 910 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
# Stage 1: build and prune dev dependencies
FROM node:23-alpine AS builder
RUN corepack enable && corepack prepare pnpm@latest --activate
WORKDIR /usr/src/app
COPY package.json pnpm-lock.yaml* ./
RUN pnpm install --frozen-lockfile
COPY . .
RUN pnpm build
RUN pnpm prune --prod
# Stage 2: runtime
FROM node:23-alpine AS runner
WORKDIR /usr/src/app
USER node
# Copy production node_modules and build artifacts
COPY --from=builder /usr/src/app/node_modules ./node_modules
COPY --from=builder /usr/src/app/dist ./dist
COPY --from=builder /usr/src/app/controllers ./controllers
COPY --from=builder /usr/src/app/routes ./routes
COPY --from=builder /usr/src/app/middleware ./middleware
COPY --from=builder /usr/src/app/services ./services
COPY --from=builder /usr/src/app/utils ./utils
COPY --from=builder /usr/src/app/db ./db
COPY --from=builder /usr/src/app/drizzle ./drizzle
COPY app.js ./
CMD ["node", "app.js"]