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:
parent
43257b422c
commit
0171494734
4 changed files with 7 additions and 9 deletions
|
|
@ -4,7 +4,6 @@ dist
|
||||||
.gitignore
|
.gitignore
|
||||||
/.vscode
|
/.vscode
|
||||||
/.DS_Store
|
/.DS_Store
|
||||||
pnpm-lock.yaml
|
|
||||||
npm-debug.log
|
npm-debug.log
|
||||||
Dockerfile
|
Dockerfile
|
||||||
docker-compose.yml
|
docker-compose.yml
|
||||||
|
|
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -9,6 +9,7 @@ lerna-debug.log*
|
||||||
|
|
||||||
node_modules
|
node_modules
|
||||||
dist
|
dist
|
||||||
|
.pnpm-store
|
||||||
dist-ssr
|
dist-ssr
|
||||||
*.local
|
*.local
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,9 @@
|
||||||
# Build stage
|
# Build stage
|
||||||
FROM node:20-alpine AS builder
|
FROM node:22 AS builder
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Install build dependencies and pnpm (via corepack)
|
# Install pnpm via corepack
|
||||||
RUN apk add --no-cache python3 make g++ && \
|
RUN corepack enable && corepack prepare pnpm@latest --activate
|
||||||
corepack enable && corepack prepare pnpm@latest --activate
|
|
||||||
|
|
||||||
# Copy package manifests first for better caching
|
# Copy package manifests first for better caching
|
||||||
COPY package.json pnpm-lock.yaml ./
|
COPY package.json pnpm-lock.yaml ./
|
||||||
|
|
@ -17,7 +16,7 @@ RUN pnpm install --frozen-lockfile
|
||||||
RUN pnpm build
|
RUN pnpm build
|
||||||
|
|
||||||
# Production image
|
# Production image
|
||||||
FROM nginx:stable-alpine
|
FROM nginx:stable
|
||||||
COPY --from=builder /app/dist /usr/share/nginx/html
|
COPY --from=builder /app/dist /usr/share/nginx/html
|
||||||
|
|
||||||
# Add custom nginx config for SPA routing
|
# Add custom nginx config for SPA routing
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
version: '3.8'
|
|
||||||
services:
|
services:
|
||||||
web:
|
web:
|
||||||
build: .
|
build: .
|
||||||
|
|
@ -10,13 +9,13 @@ services:
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
dev:
|
dev:
|
||||||
image: node:20
|
image: node:22
|
||||||
working_dir: /app
|
working_dir: /app
|
||||||
volumes:
|
volumes:
|
||||||
- ./:/app:cached
|
- ./:/app:cached
|
||||||
- /app/node_modules
|
- /app/node_modules
|
||||||
command: sh -c "corepack enable && corepack prepare pnpm@latest --activate && pnpm install && pnpm dev --host 0.0.0.0"
|
command: sh -c "corepack enable && corepack prepare pnpm@latest --activate && pnpm install && pnpm dev --host 0.0.0.0"
|
||||||
ports:
|
ports:
|
||||||
- "5173:5173"
|
- "5174:5173"
|
||||||
environment:
|
environment:
|
||||||
- CHOKIDAR_USEPOLLING=true
|
- CHOKIDAR_USEPOLLING=true
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue