Fix: Update Docker config to use pnpm instead of npm

- Switched from npm ci to pnpm install --frozen-lockfile
- Added corepack enable for pnpm support
- Added .dockerignore for cleaner builds

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-19 23:44:21 +01:00
co-authored by Claude Opus 4.5
parent 87c7ebc5e3
commit d6a67fc70f
3 changed files with 58 additions and 7 deletions
+42
View File
@@ -0,0 +1,42 @@
# Dependencies
node_modules
.pnpm-store
# Build outputs
.next
out
build
dist
# Development
.env*.local
.env.development
.env.test
# IDE
.idea
.vscode
*.swp
*.swo
# OS
.DS_Store
Thumbs.db
# Git
.git
.gitignore
# Docker
Dockerfile*
docker-compose*
.dockerignore
# Misc
*.md
!README.md
*.log
npm-debug.log*
pnpm-debug.log*
coverage
.nyc_output
+9 -5
View File
@@ -2,14 +2,18 @@
# Base image # Base image
FROM node:20-alpine AS base FROM node:20-alpine AS base
RUN apk add --no-cache libc6-compat
RUN corepack enable && corepack prepare pnpm@latest --activate
# Install dependencies only when needed # Install dependencies only when needed
FROM base AS deps FROM base AS deps
WORKDIR /app WORKDIR /app
# Install dependencies based on the preferred package manager # Copy package files
COPY package.json package-lock.json* ./ COPY package.json pnpm-lock.yaml ./
RUN npm ci
# Install dependencies
RUN pnpm install --frozen-lockfile
# Rebuild the source code only when needed # Rebuild the source code only when needed
FROM base AS builder FROM base AS builder
@@ -20,10 +24,10 @@ COPY . .
# Next.js collects anonymous telemetry data - disable it # Next.js collects anonymous telemetry data - disable it
ENV NEXT_TELEMETRY_DISABLED=1 ENV NEXT_TELEMETRY_DISABLED=1
RUN npm run build RUN pnpm run build
# Production image, copy all the files and run next # Production image, copy all the files and run next
FROM base AS runner FROM node:20-alpine AS runner
WORKDIR /app WORKDIR /app
ENV NODE_ENV=production ENV NODE_ENV=production
+7 -2
View File
@@ -1,7 +1,6 @@
version: '3.8'
services: services:
portfolio: portfolio:
container_name: portfolio-website
build: build:
context: . context: .
dockerfile: Dockerfile dockerfile: Dockerfile
@@ -14,3 +13,9 @@ services:
- NEXT_PUBLIC_GA_TRACKING_ID=${NEXT_PUBLIC_GA_TRACKING_ID} - NEXT_PUBLIC_GA_TRACKING_ID=${NEXT_PUBLIC_GA_TRACKING_ID}
- NEXT_PUBLIC_SITE_URL=${NEXT_PUBLIC_SITE_URL} - NEXT_PUBLIC_SITE_URL=${NEXT_PUBLIC_SITE_URL}
restart: unless-stopped restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://localhost:3000"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s