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

Next.js 16 with standalone output creates two separate directories:
- .next/standalone (server infrastructure)
- .next/server (compiled App Router routes)

Previous Dockerfile only copied standalone, causing all /api/*
routes to return 404 in production. This adds the missing copy
command to include compiled API route handlers.

Fixes: /api/wren/portfolios returning 404 after deployment
This commit is contained in:
Matt 2025-11-03 12:36:57 +01:00
parent 5680dfa65f
commit b8bb0c8ae3

View File

@ -22,6 +22,7 @@ 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