charles_c 5 meses atrás
pai
commit
8a4bf28572
1 arquivos alterados com 3 adições e 2 exclusões
  1. 3 2
      Dockerfile.prod

+ 3 - 2
Dockerfile.prod

@@ -44,14 +44,15 @@ RUN apk add --no-cache bash
 RUN addgroup --system --gid 1001 nodejs
 RUN addgroup --system --gid 1001 nodejs
 RUN adduser --system --uid 1001 nextjs
 RUN adduser --system --uid 1001 nextjs
 
 
-RUN mkdir -p /app/public/uploads && chown nextjs:nodejs /app/public/uploads
-
 # 复制必要文件
 # 复制必要文件
 COPY --from=builder /app/public ./public
 COPY --from=builder /app/public ./public
 COPY --from=builder --chown=nextjs:nodejs /app/.next ./.next
 COPY --from=builder --chown=nextjs:nodejs /app/.next ./.next
 COPY --from=builder /app/node_modules ./node_modules
 COPY --from=builder /app/node_modules ./node_modules
 COPY --from=builder /app/package.json ./package.json
 COPY --from=builder /app/package.json ./package.json
 
 
+# 创建 uploads 目录并设置权限
+RUN mkdir -p /app/public/uploads && chown -R nextjs:nodejs /app/public
+
 # 设置为非 root 用户
 # 设置为非 root 用户
 USER nextjs
 USER nextjs