fix: correct Docker setup so the build succeeds

- 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>
This commit is contained in:
Ali Asadi 2026-06-16 16:18:47 +03:30
parent 43257b422c
commit 0171494734
4 changed files with 7 additions and 9 deletions

View file

@ -4,7 +4,6 @@ dist
.gitignore
/.vscode
/.DS_Store
pnpm-lock.yaml
npm-debug.log
Dockerfile
docker-compose.yml

1
.gitignore vendored
View file

@ -9,6 +9,7 @@ lerna-debug.log*
node_modules
dist
.pnpm-store
dist-ssr
*.local

View file

@ -1,10 +1,9 @@
# Build stage
FROM node:20-alpine AS builder
FROM node:22 AS builder
WORKDIR /app
# Install build dependencies and pnpm (via corepack)
RUN apk add --no-cache python3 make g++ && \
corepack enable && corepack prepare pnpm@latest --activate
# 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 ./
@ -17,7 +16,7 @@ RUN pnpm install --frozen-lockfile
RUN pnpm build
# Production image
FROM nginx:stable-alpine
FROM nginx:stable
COPY --from=builder /app/dist /usr/share/nginx/html
# Add custom nginx config for SPA routing

View file

@ -1,4 +1,3 @@
version: '3.8'
services:
web:
build: .
@ -10,13 +9,13 @@ services:
restart: unless-stopped
dev:
image: node:20
image: node:22
working_dir: /app
volumes:
- ./:/app:cached
- /app/node_modules
command: sh -c "corepack enable && corepack prepare pnpm@latest --activate && pnpm install && pnpm dev --host 0.0.0.0"
ports:
- "5173:5173"
- "5174:5173"
environment:
- CHOKIDAR_USEPOLLING=true