Reduce Docker image layer size
All checks were successful
Build & Push Docker Image / build-and-push (push) Successful in 1m52s

This commit is contained in:
Tom Misch
2026-05-11 11:17:24 +02:00
parent 6f879f4d48
commit 0efe3066fc
2 changed files with 17 additions and 5 deletions

View File

@@ -2,6 +2,7 @@ _site/
.git/ .git/
.claude/ .claude/
node_modules/ node_modules/
images/
.sass-cache/ .sass-cache/
.jekyll-metadata .jekyll-metadata
*.md *.md

View File

@@ -12,15 +12,26 @@ COPY . .
RUN bundle exec jekyll build RUN bundle exec jekyll build
# === Serve-Phase: node.js backend + ImageMagick === # === Node-Dependencies: native sqlite3 mit Build-Tools bauen ===
FROM node:20-alpine FROM node:20-alpine AS node-deps
# ImageMagick fuer Thumbnails, Docker CLI fuer Admin-Sync, Build-Tools fuer sqlite3 native bindings RUN apk add --no-cache python3 make g++ sqlite-dev
RUN apk add --no-cache imagemagick docker-cli python3 make g++ build-base sqlite-dev
WORKDIR /app WORKDIR /app
COPY package*.json ./ COPY package*.json ./
RUN npm install --omit=dev RUN npm ci --omit=dev && npm cache clean --force
# === Serve-Phase: node.js backend + Runtime-Tools ===
FROM node:20-alpine
# Getrennte RUNs halten einzelne Registry-Layer klein genug fuer Proxy-Limits.
RUN apk add --no-cache docker-cli
RUN apk add --no-cache imagemagick
RUN apk add --no-cache sqlite-libs
WORKDIR /app
COPY package*.json ./
COPY --from=node-deps /app/node_modules ./node_modules
COPY backend ./backend COPY backend ./backend
COPY --from=builder /site/_site ./public COPY --from=builder /site/_site ./public