|
@@ -44,14 +44,15 @@ RUN apk add --no-cache bash
|
|
|
RUN addgroup --system --gid 1001 nodejs
|
|
|
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 --chown=nextjs:nodejs /app/.next ./.next
|
|
|
COPY --from=builder /app/node_modules ./node_modules
|
|
|
COPY --from=builder /app/package.json ./package.json
|
|
|
|
|
|
+# 创建 uploads 目录并设置权限
|
|
|
+RUN mkdir -p /app/public/uploads && chown -R nextjs:nodejs /app/public
|
|
|
+
|
|
|
# 设置为非 root 用户
|
|
|
USER nextjs
|
|
|
|