fix(dockerfile): use UID 101 instead of 1000 to avoid conflict in node:20-alpine
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 <noreply@anthropic.com>
This commit is contained in:
parent
d5c1c90c50
commit
2d07eeba10
@ -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
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user