From bae5a36492e354f0e14c7e3b80e762fa8b359865 Mon Sep 17 00:00:00 2001 From: Pepe Ziberi Date: Sat, 18 Jul 2026 22:30:42 +0200 Subject: [PATCH] =?UTF-8?q?perf(ci):=20Build-Zeit=20senken=20=E2=80=93=20B?= =?UTF-8?q?uildKit-Cache-Mounts=20+=20mode=3Dmin?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Dockerfile: --mount=type=cache für /root/.npm (npm ci) und /app/.next/cache (inkrementeller next build statt jedes Mal von Null) - deploy.yml: cache-to mode=max -> mode=min (spart auf dem NAS den ~12 Min Cache-Export, der bisher grösster Einzelposten war) - provenance/sbom aus (weniger Attestation-Export) - ENV-Legacy-Warnungen behoben (ENV key=value) - Version 1.4.5 Co-Authored-By: Claude Opus 4.8 (1M context) --- .gitea/workflows/deploy.yml | 8 +++++++- Dockerfile | 17 ++++++++++------- package.json | 2 +- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 5853278..d4c9e08 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -45,5 +45,11 @@ jobs: push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + # provenance/sbom aus: spart zusätzlichen Attestation-Export + provenance: false + sbom: false cache-from: type=registry,ref=${{ env.IMAGE }}:cache - cache-to: type=registry,ref=${{ env.IMAGE }}:cache,mode=max + # mode=min statt max: exportiert nur die finalen Schichten → auf langsamem + # NAS-Speicher spart das ~12 Min Cache-Export. Der teure Rechenaufwand + # (npm ci, next build) wird ohnehin über BuildKit-Cache-Mounts abgedeckt. + cache-to: type=registry,ref=${{ env.IMAGE }}:cache,mode=min diff --git a/Dockerfile b/Dockerfile index 3602e9b..d1e8eaf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,12 @@ +# syntax=docker/dockerfile:1 # Stage 1: Dependencies FROM node:20-alpine AS deps RUN apk add --no-cache libc6-compat openssl WORKDIR /app COPY package.json package-lock.json* ./ -RUN npm ci --ignore-scripts --legacy-peer-deps +# npm-Cache über BuildKit persistent halten (schnellere Re-Installs) +RUN --mount=type=cache,target=/root/.npm npm ci --ignore-scripts --legacy-peer-deps # Stage 2: Builder FROM node:20-alpine AS builder @@ -20,15 +22,16 @@ RUN npx prisma generate COPY .env.docker .env # Build Next.js -ENV NEXT_TELEMETRY_DISABLED 1 -RUN npm run build +ENV NEXT_TELEMETRY_DISABLED=1 +# .next/cache über BuildKit persistent halten → inkrementeller Build statt jedes Mal von Null +RUN --mount=type=cache,target=/app/.next/cache npm run build # Stage 3: Runner FROM node:20-alpine AS runner RUN apk add --no-cache openssl -ENV NODE_ENV production -ENV NEXT_TELEMETRY_DISABLED 1 +ENV NODE_ENV=production +ENV NEXT_TELEMETRY_DISABLED=1 RUN addgroup --system --gid 1001 nodejs && \ adduser --system --uid 1001 nextjs @@ -62,7 +65,7 @@ COPY --chown=nextjs:nodejs server-custom.js ./server-custom.js COPY --chown=nextjs:nodejs docker-entrypoint.sh ./docker-entrypoint.sh EXPOSE 3000 -ENV PORT 3000 -ENV HOSTNAME "0.0.0.0" +ENV PORT=3000 +ENV HOSTNAME="0.0.0.0" CMD ["sh", "docker-entrypoint.sh"] diff --git a/package.json b/package.json index 168f89b..b32308b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lageplan", - "version": "1.4.4", + "version": "1.4.5", "description": "Feuerwehr Lageplan - Krokier-App für Einsatzdokumentation", "private": true, "scripts": {