기존 사용자
This commit is contained in:
@@ -27,9 +27,6 @@ RUN npm run build
|
||||
FROM base AS runner
|
||||
ENV NODE_ENV=production
|
||||
|
||||
# Create non-root user with specific UID/GID
|
||||
RUN groupadd -r appgroup --gid 1000 && useradd -r -g appgroup --uid 1000 appuser
|
||||
|
||||
# Copy production node_modules
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
# Copy built files
|
||||
@@ -37,10 +34,10 @@ COPY --from=build /app/dist ./dist
|
||||
# Copy package files
|
||||
COPY package*.json ./
|
||||
|
||||
# Create logs and uploads directories and set permissions
|
||||
RUN mkdir -p logs uploads && chown -R appuser:appgroup logs uploads && chmod -R 755 logs uploads
|
||||
# Create logs and uploads directories and set permissions (use existing node user with UID 1000)
|
||||
RUN mkdir -p logs uploads && chown -R node:node logs uploads && chmod -R 755 logs uploads
|
||||
|
||||
EXPOSE 3001
|
||||
USER appuser
|
||||
USER node
|
||||
CMD ["node", "dist/app.js"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user