|
@@ -48,10 +48,20 @@ RUN adduser --system --uid 1001 nextjs
|
|
|
# RUN mkdir -p /app/public/uploads && chown -R nextjs:nodejs /app/public
|
|
|
|
|
|
# 复制必要文件
|
|
|
+# COPY --from=builder /app/next.config.mjs ./
|
|
|
+# 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
|
|
|
+
|
|
|
+
|
|
|
+# 复制必要文件
|
|
|
COPY --from=builder /app/next.config.mjs ./
|
|
|
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 --chown=nextjs:nodejs /app/.next/standalone ./
|
|
|
+COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
|
|
+
|
|
|
+# 复制 package.json(用于版本信息和脚本)
|
|
|
COPY --from=builder /app/package.json ./package.json
|
|
|
|
|
|
# 设置为非 root 用户
|
|
@@ -63,7 +73,8 @@ EXPOSE 3000
|
|
|
ENV PORT 3000
|
|
|
|
|
|
# 使用 bash 启动应用
|
|
|
-CMD ["/bin/bash", "-c", "node_modules/.bin/next start"]
|
|
|
+# CMD ["/bin/bash", "-c", "node_modules/.bin/next start"]
|
|
|
+CMD ["/bin/bash", "-c", "node server.js"]
|
|
|
|
|
|
# # Stage 1: Dependencies
|
|
|
# FROM node:alpine AS deps
|