This commit is contained in:
2026-05-26 08:30:08 +12:00
parent 005aab8139
commit 135a5a3b83
75 changed files with 22417 additions and 4288 deletions
+21 -3
View File
@@ -1,3 +1,4 @@
# syntax=docker/dockerfile:1.7
ARG APP_VERSION=4.0.1
FROM node:22-alpine AS builder
@@ -5,13 +6,30 @@ ARG APP_VERSION
WORKDIR /app
COPY package.json ./
COPY package-lock.json ./
# 1. Dependencies — only re-runs when package*.json change.
COPY package.json package-lock.json ./
RUN npm ci
# 2. Image assets in their own layer. Enhanced-img content-hashes its inputs,
# so when these files are unchanged the BuildKit cache mount below replays
# the previous WebP/AVIF outputs instead of regenerating them.
COPY src/lib/images ./src/lib/images
COPY static ./static
# 3. Build config (changes rarely).
COPY svelte.config.js vite.config.ts tsconfig.json ./
# 4. Everything else. Component-only edits invalidate this layer but the vite
# transform cache below keeps the expensive image pipeline warm.
COPY . .
RUN node --experimental-strip-types --import="file:///app/scripts/sveltekit-resolver.mjs" scripts/export-homepage-content.mjs
RUN npm run build
# Persist vite's transform cache across builds. Enhanced-img stores its
# generated raster variants here keyed by source-image hash, so unchanged
# images skip the sharp/resize/encode pass entirely.
RUN --mount=type=cache,target=/app/node_modules/.vite,sharing=locked \
npm run build
FROM node:22-alpine AS runner
ARG APP_VERSION