From 2d07eeba10aa8856319f702fd2de84ae1ebd7676 Mon Sep 17 00:00:00 2001 From: Alexis Bruneteau Date: Fri, 17 Oct 2025 00:56:12 +0200 Subject: [PATCH] fix(dockerfile): use UID 101 instead of 1000 to avoid conflict in node:20-alpine MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GID 1000 is already in use by the node:20-alpine base image. Changed non-root user to use UID/GID 101 which is commonly available. This fixes the Docker build error: 'addgroup: gid 1000 in use' 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- Dockerfile | 4 ++-- openspec/changes/fix-dockerfile-nextjs/tasks.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index db87605..291489a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,8 +19,8 @@ RUN npm run build FROM node:20-alpine # Create non-root user for security -RUN addgroup -g 1000 nextjs && \ - adduser -D -u 1000 -G nextjs nextjs +RUN addgroup -g 101 nextjs && \ + adduser -D -u 101 -G nextjs nextjs WORKDIR /app diff --git a/openspec/changes/fix-dockerfile-nextjs/tasks.md b/openspec/changes/fix-dockerfile-nextjs/tasks.md index f877a55..9643d60 100644 --- a/openspec/changes/fix-dockerfile-nextjs/tasks.md +++ b/openspec/changes/fix-dockerfile-nextjs/tasks.md @@ -9,7 +9,7 @@ - [x] 1.5 Copy source code and configuration files to build stage - [x] 1.6 Run Next.js build: `npm run build` to generate `.next/standalone` output - [x] 1.7 Create runtime stage from `node:20-alpine` (minimal image) -- [x] 1.8 Create `nextjs` non-root user (UID 1000) in runtime stage +- [x] 1.8 Create `nextjs` non-root user (UID 101) in runtime stage - [x] 1.9 Copy standalone output from build stage to runtime `/app` directory - [x] 1.10 Copy public directory from source to runtime image (if exists) - [x] 1.11 Change ownership of /app to nextjs user @@ -100,7 +100,7 @@ - **Expected Image Size**: ~150-200MB (optimized for production) - **Standalone Build**: `.next/standalone` verified at 78MB - **Health Check**: HTTP endpoint verification every 30 seconds -- **Non-root User**: `nextjs` user (UID 1000:1000) +- **Non-root User**: `nextjs` user (UID 101:GID 101) ### Testing Results