-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
46 lines (31 loc) · 1009 Bytes
/
Dockerfile
File metadata and controls
46 lines (31 loc) · 1009 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
43
44
45
46
# ---- Build Stage ----
FROM node:20-alpine AS builder
# Install pnpm globally
RUN corepack enable && corepack prepare pnpm@latest --activate
# Set working directory
WORKDIR /app
# Copy package files
COPY package.json pnpm-lock.yaml ./
# Install dependencies
RUN pnpm install --frozen-lockfile
# Copy the rest of the code
COPY . .
# Build the application
RUN pnpm run build
# ---- Production Stage ----
FROM node:20-alpine AS production
# Install pnpm globally
RUN corepack enable && corepack prepare pnpm@latest --activate
WORKDIR /app
# Set environment to production
ENV NODE_ENV=production
# Copy package files and install only production dependencies
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --prod --frozen-lockfile
# Copy built application from builder stage - use .output instead of dist
COPY --from=builder /app/.output ./.output
COPY --from=builder /app/public ./public
# Expose the port the app will run on
EXPOSE 3000
# Start the application
CMD ["pnpm", "run", "start"]