-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathDockerfile
More file actions
36 lines (25 loc) · 963 Bytes
/
Dockerfile
File metadata and controls
36 lines (25 loc) · 963 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
28
29
30
31
32
33
34
35
36
# Use pnpm official image for better caching and consistency
FROM node:22.12-alpine AS builder
# Install pnpm
RUN npm install -g pnpm@9.14.4
WORKDIR /app
# Copy package manifests and install dependencies (including dev for build)
COPY package.json pnpm-lock.yaml ./
RUN --mount=type=cache,target=/root/.local/share/pnpm/store pnpm install --frozen-lockfile
# Copy the rest of the application code
COPY . .
# Build the application (creates the dist folder)
RUN pnpm build
# Remove dev dependencies after build
RUN pnpm prune --prod
# --- Release Stage ---
FROM node:22-alpine AS release
WORKDIR /app
ENV NODE_ENV=production
# Copy necessary artifacts from the builder stage
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/bin ./bin
COPY --from=builder /app/package.json ./package.json # Good practice to include
# Set the entrypoint to your CLI script
ENTRYPOINT ["node", "bin/cli.mjs"]