From 580aa014ca97bb7f91eb6d929069d1ae51633e22 Mon Sep 17 00:00:00 2001 From: mark Date: Wed, 18 Feb 2026 00:21:04 +0000 Subject: [PATCH] Fix: add CMD node server.js for Next.js standalone build --- Dockerfile | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index e0aa5fd..0f1c48a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,7 @@ FROM base AS deps RUN apk add --no-cache libc6-compat python3 make g++ WORKDIR /app -# Copy package files only - skip postinstall scripts (prisma generate runs in builder stage) +# Copy package files - skip postinstall (prisma generate runs in builder stage) COPY package*.json ./ RUN npm ci --legacy-peer-deps --ignore-scripts @@ -19,17 +19,16 @@ WORKDIR /app COPY --from=deps /app/node_modules ./node_modules COPY . . -# Set environment variables for build ENV NEXT_TELEMETRY_DISABLED=1 ENV NODE_ENV=production -# Generate Prisma Client (schema is now available from COPY . .) +# Generate Prisma Client (schema is available from COPY . .) RUN npx prisma generate -# Build the application (DATABASE_URL will be available via Coolify env vars) +# Build the application RUN npm run build -# Production image, copy all the files and run next +# Production image FROM base AS runner WORKDIR /app @@ -39,12 +38,10 @@ ENV NEXT_TELEMETRY_DISABLED=1 RUN addgroup --system --gid 1001 nodejs RUN adduser --system --uid 1001 nextjs -# Copy built application COPY --from=builder /app/public ./public COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static -# Copy Prisma files for runtime COPY --from=builder /app/node_modules/.prisma ./node_modules/.prisma COPY --from=builder /app/node_modules/@prisma ./node_modules/@prisma COPY --from=builder /app/prisma ./prisma @@ -56,3 +53,5 @@ EXPOSE 3000 ENV PORT=3000 ENV HOSTNAME="0.0.0.0" +CMD ["node", "server.js"] +