Switch final stage to node:20-slim for better-sqlite3 compatibility
Docker Build and Push / build (push) Failing after 6m41s

Alpine's musl libc causes repeated npm ci failures for better-sqlite3's
native module compilation. node:20-slim (Debian) uses glibc and compiles
reliably. Client builder stage stays Alpine since it has no native deps.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
nmemmertandClaude Sonnet 4.6 committed 2026-08-26 15:06:32 -04:00
1 parent 559a47c092
commit 9c5468fe7e
1 file changed
+13 -14
+13 -14
View File
@@ -16,21 +16,21 @@ COPY client/public ./public
# Build React app
RUN npm run build
# Final stage - Node.js server
FROM node:20-alpine
# Final stage - Node.js server (slim Debian for glibc native module compatibility)
FROM node:20-slim
WORKDIR /app
# Install dumb-init for proper signal handling
RUN apk add --no-cache dumb-init
# Install dumb-init and build tools needed by better-sqlite3
RUN apt-get update && apt-get install -y --no-install-recommends \
dumb-init python3 make g++ \
&& rm -rf /var/lib/apt/lists/*
# Copy server package files
COPY package*.json ./
# Install build tools for native modules (better-sqlite3), then install deps
RUN apk add --no-cache python3 build-base linux-headers && \
npm ci --omit=dev && \
apk del python3 build-base linux-headers
# Install production dependencies only
RUN npm ci --omit=dev
# Copy server code
COPY server ./server
@@ -38,12 +38,11 @@ COPY server ./server
# Copy built React client from builder stage
COPY --from=client-builder /app/client/build ./client/build
# Create data directory and set permissions
RUN mkdir -p /app/data && chown -R 1001:1001 /app
# Create non-root user
RUN addgroup -g 1001 -S nodejs && \
adduser -S nodejs -u 1001
# Create non-root user and data directory
RUN groupadd -g 1001 nodejs && \
useradd -u 1001 -g nodejs nodejs && \
mkdir -p /app/data && \
chown -R nodejs:nodejs /app
USER nodejs