Dockerfile: node:22-trixie-slim (glibc 2.41) — better-sqlite3-prebuilds funkar, source-build gick ej att tvinga (bundlade prebuilds, inget install-script)
Some checks failed
build-and-push / build (push) Failing after 1m3s

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01824ZrvG2mDYYrmwqypLNup
This commit is contained in:
2026-08-01 02:01:59 +02:00
parent 2f08809595
commit 6ff8e4d7ca

View File

@@ -1,25 +1,23 @@
# Multi-stage: frontend-bygge -> backend-deps -> slim runtime (arm64 på Pi5)
# OBS: trixie (glibc 2.41), inte bookworm — better-sqlite3:s bundlade
# arm64-prebuild kräver GLIBC >= 2.38 och paketet har inget install-script,
# så source-build går inte att tvinga via npm ci.
ARG BUILD_CPUS=2
FROM node:22-slim AS frontend
FROM node:22-trixie-slim AS frontend
WORKDIR /f
COPY frontend/package.json frontend/package-lock.json ./
RUN npm ci --no-audit --no-fund
COPY frontend/ ./
RUN npm run build
FROM node:22-slim AS backend
# python3/make/g++ för att kompilera better-sqlite3 från källkod —
# prebuilt-binären kräver glibc 2.38 men bookworm har 2.36 (lastar annars
# inte i runtime: "GLIBC_2.38 not found")
RUN apt-get update && apt-get install -y --no-install-recommends python3 make g++ \
&& rm -rf /var/lib/apt/lists/*
FROM node:22-trixie-slim AS backend
WORKDIR /app
COPY backend/package.json backend/package-lock.json ./
RUN npm_config_build_from_source=true npm ci --omit=dev --no-audit --no-fund
RUN npm ci --omit=dev --no-audit --no-fund
COPY backend/src ./src
FROM node:22-slim
FROM node:22-trixie-slim
ENV NODE_ENV=production
WORKDIR /app
COPY --from=backend /app ./