|
@@ -7,7 +7,7 @@ RUN npm install -g pnpm
|
|
|
WORKDIR /app
|
|
|
|
|
|
# 复制 pnpm 相关文件
|
|
|
-COPY package.json pnpm-lock.yaml .npmrc* ./
|
|
|
+COPY package.json pnpm-lock.yaml* .npmrc* ./
|
|
|
|
|
|
# 使用 pnpm 安装依赖
|
|
|
RUN pnpm install --frozen-lockfile
|
|
@@ -19,7 +19,7 @@ WORKDIR /app
|
|
|
# 安装 pnpm
|
|
|
RUN npm install -g pnpm
|
|
|
|
|
|
-# 复制依赖
|
|
|
+# 复制依赖和源代码
|
|
|
COPY --from=deps /app/node_modules ./node_modules
|
|
|
COPY . .
|
|
|
|
|
@@ -42,8 +42,8 @@ RUN adduser -S nextjs -u 1001
|
|
|
# 复制必要文件
|
|
|
COPY --from=builder /app/public ./public
|
|
|
COPY --from=builder /app/package.json ./package.json
|
|
|
-COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
|
|
-COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
|
|
+COPY --from=builder /app/node_modules ./node_modules
|
|
|
+COPY --from=builder --chown=nextjs:nodejs /app/.next ./.next
|
|
|
|
|
|
USER nextjs
|
|
|
|
|
@@ -52,4 +52,4 @@ EXPOSE 3000
|
|
|
ENV PORT 3000
|
|
|
ENV NEXT_TELEMETRY_DISABLED 1
|
|
|
|
|
|
-CMD ["sh", "-c", "if [ -d .next/standalone ]; then node .next/standalone/server.js; else node_modules/.bin/next start; fi"]
|
|
|
+CMD ["node", "node_modules/.bin/next", "start"]
|