perf(ci): Build-Zeit senken – BuildKit-Cache-Mounts + mode=min
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 32m35s
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 32m35s
- 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) <noreply@anthropic.com>
This commit is contained in:
@@ -45,5 +45,11 @@ jobs:
|
|||||||
push: true
|
push: true
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
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-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
|
||||||
|
|||||||
17
Dockerfile
17
Dockerfile
@@ -1,10 +1,12 @@
|
|||||||
|
# syntax=docker/dockerfile:1
|
||||||
# Stage 1: Dependencies
|
# Stage 1: Dependencies
|
||||||
FROM node:20-alpine AS deps
|
FROM node:20-alpine AS deps
|
||||||
RUN apk add --no-cache libc6-compat openssl
|
RUN apk add --no-cache libc6-compat openssl
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY package.json package-lock.json* ./
|
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
|
# Stage 2: Builder
|
||||||
FROM node:20-alpine AS builder
|
FROM node:20-alpine AS builder
|
||||||
@@ -20,15 +22,16 @@ RUN npx prisma generate
|
|||||||
COPY .env.docker .env
|
COPY .env.docker .env
|
||||||
|
|
||||||
# Build Next.js
|
# Build Next.js
|
||||||
ENV NEXT_TELEMETRY_DISABLED 1
|
ENV NEXT_TELEMETRY_DISABLED=1
|
||||||
RUN npm run build
|
# .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
|
# Stage 3: Runner
|
||||||
FROM node:20-alpine AS runner
|
FROM node:20-alpine AS runner
|
||||||
RUN apk add --no-cache openssl
|
RUN apk add --no-cache openssl
|
||||||
|
|
||||||
ENV NODE_ENV production
|
ENV NODE_ENV=production
|
||||||
ENV NEXT_TELEMETRY_DISABLED 1
|
ENV NEXT_TELEMETRY_DISABLED=1
|
||||||
|
|
||||||
RUN addgroup --system --gid 1001 nodejs && \
|
RUN addgroup --system --gid 1001 nodejs && \
|
||||||
adduser --system --uid 1001 nextjs
|
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
|
COPY --chown=nextjs:nodejs docker-entrypoint.sh ./docker-entrypoint.sh
|
||||||
|
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
ENV PORT 3000
|
ENV PORT=3000
|
||||||
ENV HOSTNAME "0.0.0.0"
|
ENV HOSTNAME="0.0.0.0"
|
||||||
|
|
||||||
CMD ["sh", "docker-entrypoint.sh"]
|
CMD ["sh", "docker-entrypoint.sh"]
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "lageplan",
|
"name": "lageplan",
|
||||||
"version": "1.4.4",
|
"version": "1.4.5",
|
||||||
"description": "Feuerwehr Lageplan - Krokier-App für Einsatzdokumentation",
|
"description": "Feuerwehr Lageplan - Krokier-App für Einsatzdokumentation",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user