26 lines
523 B
Docker
26 lines
523 B
Docker
# --- Stage 1: Build ---
|
|
FROM node:22-alpine AS build
|
|
WORKDIR /app
|
|
|
|
# Install pnpm
|
|
RUN corepack enable && corepack prepare pnpm@latest --activate
|
|
|
|
# Install dependencies first (cache layer)
|
|
COPY package.json pnpm-lock.yaml ./
|
|
RUN pnpm install --frozen-lockfile
|
|
|
|
# Copy source and build
|
|
COPY . .
|
|
RUN pnpm build
|
|
|
|
# --- Stage 2: Serve ---
|
|
FROM nginx:alpine AS runtime
|
|
|
|
# Custom nginx config
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
# Copy built static files
|
|
COPY --from=build /app/dist /usr/share/nginx/html
|
|
|
|
EXPOSE 80
|