fix: use node:22-slim for builder stage to fix better-sqlite3 musl/glibc mismatch

This commit is contained in:
Nox
2026-04-02 19:48:12 +02:00
parent bde1af8ccf
commit 2996da08df
+6 -3
View File
@@ -1,10 +1,14 @@
# ── Stage 1: Build ────────────────────────────────────────────── # ── Stage 1: Build ──────────────────────────────────────────────
FROM node:22-alpine AS builder # Utiliser Debian (slim) pour builder ET runtime → même libc (glibc)
# Évite l'incompatibilité musl/glibc avec better-sqlite3 (addon natif)
FROM node:22-slim AS builder
WORKDIR /app WORKDIR /app
# Install build dependencies for better-sqlite3 (native addon) # Install build dependencies for better-sqlite3 (native addon)
RUN apk add --no-cache python3 make g++ RUN apt-get update && apt-get install -y --no-install-recommends \
python3 make g++ \
&& rm -rf /var/lib/apt/lists/*
COPY package.json package-lock.json ./ COPY package.json package-lock.json ./
RUN npm ci RUN npm ci
@@ -17,7 +21,6 @@ FROM node:22-slim
WORKDIR /app WORKDIR /app
# better-sqlite3 needs shared libs available in slim
RUN apt-get update && apt-get install -y --no-install-recommends \ RUN apt-get update && apt-get install -y --no-install-recommends \
tini \ tini \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*