-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
executable file
·38 lines (28 loc) · 970 Bytes
/
Dockerfile
File metadata and controls
executable file
·38 lines (28 loc) · 970 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
# ---- Base Stage ----
FROM node:18-alpine AS base
RUN apk add --no-cache libc6-compat
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable && corepack prepare pnpm@latest --activate
# ---- Dependencies Stage ----
FROM base AS deps
WORKDIR /app
# Copy lockfile and package manifest for reproducible installs
COPY package.json pnpm-lock.yaml ./
# Install all dependencies (including optional native binaries for linux-musl-x64)
RUN pnpm install --frozen-lockfile
# ---- Builder Stage ----
FROM base AS builder
WORKDIR /app
# Copy installed node_modules from deps stage
COPY --from=deps /app/node_modules ./node_modules
# Copy the rest of the source
COPY . .
# Build the Next.js application (outputs static files to /app/out)
RUN pnpm run build
# ---- Run Stage ----
FROM nginx:alpine AS runner
# Copy exported static site into nginx html directory
COPY --from=builder /app/out /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]