Skip to content

Commit 8f82925

Browse files
committed
fix: use existing node user (uid:gid 1000:1000) instead of creating new user
- Leverages node:18-alpine's existing node user with proper uid:gid 1000:1000 - Eliminates uid/gid conflicts during Docker build - Maintains security by avoiding system service account permissions - Completes fix for issue #109
1 parent 69f0009 commit 8f82925

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ FROM node:18-alpine
2828

2929
WORKDIR /usr/src/app
3030

31-
# Create a non-root user and group with uid:gid 1000:1000 (standard user)
32-
RUN addgroup -g 1000 appgroup && adduser -u 1000 -G appgroup -s /bin/sh -D appuser
31+
# Use existing node user (uid:gid 1000:1000) instead of system service accounts
32+
# The node:18-alpine image already has a 'node' user with uid:gid 1000:1000
3333

3434
# Copy necessary files from builder stage
3535
# Copy node_modules first (can be large)
@@ -48,10 +48,10 @@ RUN mkdir -p /usr/src/app/config /usr/src/app/data
4848

4949
# Ensure correct ownership of application files
5050
# Use /usr/src/app to cover everything copied
51-
RUN chown -R appuser:appgroup /usr/src/app
51+
RUN chown -R node:node /usr/src/app
5252

5353
# Switch to non-root user
54-
USER appuser
54+
USER node
5555

5656
# Set environment variable to indicate Docker deployment
5757
ENV DOCKER_DEPLOYMENT=true

0 commit comments

Comments
 (0)