From 90b33909f604f150ac1cfd3e898c8c5b70493163 Mon Sep 17 00:00:00 2001 From: Benno Tielen Date: Wed, 18 Feb 2026 07:27:29 +0100 Subject: [PATCH] fix: upgrade to bookworm-slim as base --- Dockerfile | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0ced227..abf572b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,6 @@ -# From https://github.com/vercel/next.js/blob/canary/examples/with-docker/Dockerfile - -FROM node:22-alpine AS base +FROM node:22-bookworm-slim AS base RUN corepack enable; -RUN apk add --no-cache libc6-compat + # Install dependencies only when needed FROM base AS deps @@ -12,7 +10,7 @@ WORKDIR /app COPY package.json yarn.lock* .yarnrc.yml package-lock.json* pnpm-lock.yaml* ./ RUN \ if [ -f yarn.lock ]; then yarn --frozen-lockfile; \ - elif [ -f package-lock.json ]; then npm ci && npm install --os=linux --libc=musl --cpu=x64 sharp; \ + elif [ -f package-lock.json ]; then npm ci; \ elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm i --frozen-lockfile; \ else echo "Lockfile not found." && exit 1; \ fi @@ -42,8 +40,9 @@ WORKDIR /app ENV NODE_ENV=production -RUN addgroup -g 1001 -S nodejs -RUN adduser -S nextjs -u 1001 +# Use groupadd and useradd (standard Linux tools) instead of Alpine's syntax +RUN groupadd --gid 1001 nodejs +RUN useradd --uid 1001 --gid nodejs --shell /bin/bash --create-home nextjs # Automatically leverage output traces to reduce image size # https://nextjs.org/docs/advanced-features/output-file-tracing