-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
41 lines (28 loc) · 1.18 KB
/
Copy pathDockerfile
File metadata and controls
41 lines (28 loc) · 1.18 KB
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
36
37
38
39
40
41
# Dockerfile
# ── Stage 1: Builder ──────────────────────────────────────────────────────────
FROM node:24-alpine AS builder
WORKDIR /app
# Install pnpm
RUN corepack enable && corepack prepare pnpm@latest --activate
# Install all dependencies (including dev) for the build step
COPY package.json pnpm-lock.yaml* ./
RUN pnpm install --frozen-lockfile
# Copy source and compile
COPY tsconfig.json ./
COPY src ./src
RUN pnpm build
# ── Stage 2: Runtime ──────────────────────────────────────────────────────────
FROM node:24-alpine AS runner
WORKDIR /app
# Install pnpm
RUN corepack enable && corepack prepare pnpm@latest --activate
# Install production dependencies only
COPY package.json pnpm-lock.yaml* ./
RUN pnpm install --frozen-lockfile --prod
# Copy compiled output and seed data from the builder
COPY --from=builder /app/dist ./dist
COPY data ./data
EXPOSE 3200
# Run as non-root for least-privilege security
USER node
CMD ["node", "dist/index.js"]