- Remove pnpm-lock.yaml from .dockerignore (required by --frozen-lockfile) - Switch builder from node:20-alpine to node:22 (pnpm@latest needs Node 22+) - Switch nginx:stable-alpine to nginx:stable (alpine tags timed out on pull) - Remove apk dependencies not needed for this pure JS project - Fix dev service port to 5174 to avoid conflict with production on 5173 - Drop obsolete docker-compose version field - Add .pnpm-store to .gitignore Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
27 lines
581 B
Docker
27 lines
581 B
Docker
# Build stage
|
|
FROM node:22 AS builder
|
|
WORKDIR /app
|
|
|
|
# Install pnpm via corepack
|
|
RUN corepack enable && corepack prepare pnpm@latest --activate
|
|
|
|
# Copy package manifests first for better caching
|
|
COPY package.json pnpm-lock.yaml ./
|
|
|
|
# Copy the rest of the project
|
|
COPY . .
|
|
|
|
# Install deps and build
|
|
RUN pnpm install --frozen-lockfile
|
|
RUN pnpm build
|
|
|
|
# Production image
|
|
FROM nginx:stable
|
|
COPY --from=builder /app/dist /usr/share/nginx/html
|
|
|
|
# Add custom nginx config for SPA routing
|
|
COPY docker/nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
EXPOSE 80
|
|
|
|
CMD ["nginx", "-g", "daemon off;"]
|