-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
42 lines (29 loc) · 922 Bytes
/
Dockerfile
File metadata and controls
42 lines (29 loc) · 922 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
41
42
# --- Stage 1: Build ---
FROM node:20-alpine AS builder
# Install dependencies
RUN npm install -g pnpm
# Set working directory
WORKDIR /app
# Copy files
COPY . .
# Install project dependencies
RUN pnpm install
# Build the app
RUN pnpm build
# --- Stage 2: Run ---
FROM node:20-alpine AS runner
# Install pnpm
RUN npm install -g pnpm
# Set working directory
WORKDIR /app
# Copy built app and necessary files from builder
COPY --from=builder /app/build ./build
COPY --from=builder /app/package.json ./
COPY --from=builder /app/pnpm-lock.yaml ./
COPY --from=builder /app/.env ./
# Install only production dependencies
RUN pnpm install --prod
# Expose port (defaults to 3000, can be changed via .env)
EXPOSE 3000
# Start the server
CMD ["node", "build"]