refactor(docker): 优化Dockerfile中的用户和组创建命令
Some checks failed
CI / build (20.15.1) (push) Failing after 23m15s
Some checks failed
CI / build (20.15.1) (push) Failing after 23m15s
使用更简洁的useradd和addgroup命令替代原有写法,保持功能不变但提高可读性
This commit is contained in:
parent
d92202b6ab
commit
97187806e1
@ -5,8 +5,8 @@ FROM oven/bun:latest AS base
|
||||
WORKDIR /app
|
||||
|
||||
# Create a non-root user for running the production application
|
||||
RUN addgroup --system --gid 1001 nodejs \
|
||||
&& adduser --system --uid 1001 nextjs
|
||||
RUN groupadd -r -g 1001 nodejs && \
|
||||
useradd -r -u 1001 -g nodejs -d /home/nextjs -m nextjs
|
||||
|
||||
# Change to non-root user
|
||||
USER nextjs
|
||||
|
||||
@ -5,8 +5,8 @@ FROM oven/bun:latest AS base
|
||||
WORKDIR /app
|
||||
|
||||
# Create non-root user and set permissions
|
||||
RUN addgroup --system --gid 1001 nodejs \
|
||||
&& adduser --system --uid 1001 nextjs
|
||||
RUN addgroup -r -g 1001 nodejs && \
|
||||
useradd -r -u 1001 -g nodejs -d /home/nextjs -m nextjs
|
||||
|
||||
# Copy build output and static files
|
||||
COPY ./apps/user/.next/standalone ./
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user