-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (28 loc) · 955 Bytes
/
Dockerfile
File metadata and controls
40 lines (28 loc) · 955 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
37
38
39
40
# Use Node.js 24 LTS base image
FROM node:24.15.0-alpine AS builder
# Enable pnpm via corepack
RUN corepack enable
# Set working directory
WORKDIR /app
# Copy all source files first
COPY . .
# Install all dependencies including dev dependencies
RUN pnpm install --frozen-lockfile
# Build the TypeScript files
RUN pnpm run build
# Use a smaller base image for the release
FROM node:24.15.0-slim AS release
# Enable pnpm via corepack
RUN corepack enable
# Set working directory
WORKDIR /app
# Copy only the necessary files from builder
COPY --from=builder /app/build /app/build
COPY --from=builder /app/package.json /app/package.json
COPY --from=builder /app/pnpm-lock.yaml /app/pnpm-lock.yaml
# Install only production dependencies without running prepare script
RUN pnpm install --prod --frozen-lockfile --ignore-scripts
# Set environment variable for Node.js
ENV NODE_ENV=production
# Set the entrypoint
ENTRYPOINT ["node", "build/index.js"]