charles_c 5 months ago
parent
commit
408f7f99d5
1 changed files with 8 additions and 2 deletions
  1. 8 2
      Dockerfile.prod

+ 8 - 2
Dockerfile.prod

@@ -53,10 +53,16 @@ COPY --from=builder /app/package.json ./package.json
 # 设置权限
 RUN mkdir -p /app/public/uploads
 RUN chown -R nextjs:nodejs /app/public/uploads
+RUN chmod 2775 /app/public/uploads
+
+RUN usermod -a -G nodejs nextjs
 
 # 临时提升权限以允许写入上传目录
-USER root
-RUN chmod 777 /app/public/uploads
+# USER root
+# RUN chmod 777 /app/public/uploads
+
+# 设置 umask
+RUN echo "umask 0002" >> /home/nextjs/.bashrc
 
 # 设置为非 root 用户
 USER nextjs