From 791c0e54d3675fbe105bfac7bcc0e8aae64da95c Mon Sep 17 00:00:00 2001 From: Mackie Date: Fri, 22 May 2026 05:06:29 +0800 Subject: [PATCH] your commit --- Dockerfile | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index 05fbf95..2de354f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,26 +1,17 @@ -# To use this Dockerfile, you have to set `output: 'standalone'` in your next.config.js file. - FROM node:20-alpine AS base -# Install dependencies only when needed FROM base AS deps RUN apk add --no-cache libc6-compat WORKDIR /app - -# Copy lockfile and install deps with pnpm COPY package.json pnpm-lock.yaml ./ RUN corepack enable && corepack prepare pnpm@10.11.0 --activate && pnpm i --frozen-lockfile -# Rebuild the source code only when needed FROM base AS builder WORKDIR /app COPY --from=deps /app/node_modules ./node_modules COPY . . - -# Enable corepack again for build stage RUN corepack enable && corepack prepare pnpm@10.11.0 --activate && pnpm run build -# Production image, copy all the files and run next FROM base AS runner WORKDIR /app @@ -30,14 +21,14 @@ RUN addgroup --system --gid 1001 nodejs RUN adduser --system --uid 1001 nextjs COPY --from=builder /app/public ./public +COPY --from=builder /app/node_modules ./node_modules +COPY --from=builder /app/package.json ./package.json RUN mkdir .next RUN chown nextjs:nodejs .next COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static -COPY --from=builder --chown=nextjs:nodejs /app/node_modules/.bin/payload ./node_modules/.bin/payload -COPY --from=builder --chown=nextjs:nodejs /app/node_modules/payload ./node_modules/payload USER nextjs @@ -45,4 +36,4 @@ EXPOSE 3001 ENV PORT=3001 ENV HOSTNAME="0.0.0.0" -CMD ["sh", "-c", "find /app/node_modules -name 'payload.js' -path '*/bin/*' 2>/dev/null && node server.js"] \ No newline at end of file +CMD ["sh", "-c", "node node_modules/.bin/payload migrate && node server.js"] \ No newline at end of file