33 lines
593 B
Docker
33 lines
593 B
Docker
# ===== Stage 1: Build =====
|
|
FROM node:22-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Install pnpm
|
|
RUN corepack enable && corepack prepare pnpm@10 --activate
|
|
|
|
# Copy package manifests
|
|
COPY frontend/package.json frontend/pnpm-lock.yaml ./
|
|
|
|
# Install deps
|
|
RUN pnpm install --frozen-lockfile
|
|
|
|
# Copy source
|
|
COPY frontend/ ./
|
|
|
|
# Build
|
|
RUN pnpm build
|
|
|
|
# ===== Stage 2: Serve with nginx =====
|
|
FROM nginx:alpine
|
|
|
|
# Copy built assets
|
|
COPY --from=builder /app/dist /usr/share/nginx/html
|
|
|
|
# Copy nginx config
|
|
COPY frontend/nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
EXPOSE 80
|
|
|
|
CMD ["nginx", "-g", "daemon off;"]
|