Fix API routes 404 - Remove incorrect .next/server copy
All checks were successful
Build and Push Docker Images / docker (push) Successful in 2m12s

The previous fix incorrectly copied .next/server which conflicts
with Next.js standalone mode. Standalone is self-contained and
already includes compiled API routes internally.

Root cause: Next.js output:'standalone' creates a self-contained
.next/standalone directory that already contains all compiled API
routes. Copying .next/server separately creates path conflicts that
break the server's route resolution.

Official Next.js standalone pattern only requires copying:
- .next/standalone (contains server.js and routes)
- .next/static (static assets)
- public (public files)

Fixes: API routes returning 404 in production
This commit is contained in:
Matt 2025-11-03 13:12:15 +01:00
parent b8bb0c8ae3
commit 6e2b841d9e

View File

@ -22,7 +22,6 @@ WORKDIR /app
# Copy standalone server files from build stage
COPY --from=build /app/.next/standalone ./
COPY --from=build /app/.next/static ./.next/static
COPY --from=build /app/.next/server ./.next/server
COPY --from=build /app/public ./public
# Expose port 3000