fix: 添加 -m 参数创建用户home目录
npm cache 需要写入 /home/nestjs 目录,useradd 需要 -m 参数才会创建 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
b49c9e1af5
commit
c77cb7a55f
|
|
@ -33,9 +33,9 @@ RUN ls -la dist/src/ && test -f dist/src/main.js
|
|||
# Production stage - use Debian slim for OpenSSL compatibility
|
||||
FROM node:20-slim
|
||||
|
||||
# Create non-root user first
|
||||
# Create non-root user with home directory (npm cache needs it)
|
||||
RUN groupadd -g 1001 nodejs && \
|
||||
useradd -u 1001 -g nodejs nestjs
|
||||
useradd -u 1001 -g nodejs -m nestjs
|
||||
|
||||
# Install OpenSSL, CA certificates, and curl for health checks
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
|
|
|
|||
|
|
@ -33,9 +33,9 @@ RUN ls -la dist/ && test -f dist/main.js
|
|||
# Production stage - use Debian slim for OpenSSL compatibility
|
||||
FROM node:20-slim
|
||||
|
||||
# Create non-root user first
|
||||
# Create non-root user with home directory (npm cache needs it)
|
||||
RUN groupadd -g 1001 nodejs && \
|
||||
useradd -u 1001 -g nodejs nestjs
|
||||
useradd -u 1001 -g nodejs -m nestjs
|
||||
|
||||
# Install OpenSSL and curl for health checks
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
|
|
|
|||
Loading…
Reference in New Issue