-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
35 lines (24 loc) · 802 Bytes
/
Dockerfile
File metadata and controls
35 lines (24 loc) · 802 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
# Build stage
FROM node:20 AS build
WORKDIR /app
# Install pnpm globally
RUN corepack enable && corepack prepare pnpm@latest --activate
# Copy package files and install dependencies
COPY package*.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile
# Copy the entire app and build
COPY . .
RUN pnpm run build
# Production stage
FROM node:20-slim AS production
WORKDIR /app
# Install pnpm globally for the production stage
RUN corepack enable && corepack prepare pnpm@latest --activate
# Copy only the necessary files
COPY package*.json pnpm-lock.yaml ./
# Install production dependencies
RUN pnpm install --frozen-lockfile --prod
# Copy the built application from the build stage
COPY --from=build /app/dist ./dist
# Set the default command to run the app
CMD ["node", "dist/index.js"]