From 0b02944180bcba0b5cb9122a514b3b92683e4258 Mon Sep 17 00:00:00 2001 From: "Stephanos A." Date: Tue, 2 Jun 2026 23:30:51 +0300 Subject: [PATCH] fix: Update Dockerfile.web to support Next.js .next directory output - Check for both .next (Next.js) and dist (Vite/other) directories - Copy .next and public assets for Next.js builds - Fallback to dist directory for other build tools - Fixes build verification for @edr/passenger-backoffice Next.js app --- infrastructure/docker/Dockerfile.web | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/infrastructure/docker/Dockerfile.web b/infrastructure/docker/Dockerfile.web index 9d252ee95..d5d2fe4ac 100644 --- a/infrastructure/docker/Dockerfile.web +++ b/infrastructure/docker/Dockerfile.web @@ -41,8 +41,9 @@ RUN NODE_OPTIONS="--max-old-space-size=4096" pnpm turbo build --filter="${TURBO_ exit 1) # Verify build output exists before proceeding -RUN if [ ! -d "/app/${APP_PATH}/dist" ]; then \ - echo "ERROR: Build output directory not found at /app/${APP_PATH}/dist"; \ +# Check for .next directory (Next.js) or dist directory (Vite/other) +RUN if [ ! -d "/app/${APP_PATH}/.next" ] && [ ! -d "/app/${APP_PATH}/dist" ]; then \ + echo "ERROR: Build output directory not found at /app/${APP_PATH}/.next or /app/${APP_PATH}/dist"; \ echo "Contents of /app/${APP_PATH}:"; \ ls -la /app/${APP_PATH}/ 2>/dev/null || echo "Directory does not exist"; \ exit 1; \ @@ -51,6 +52,14 @@ RUN if [ ! -d "/app/${APP_PATH}/dist" ]; then \ FROM nginx:alpine AS runner ARG APP_PATH COPY infrastructure/nginx/spa.conf /etc/nginx/conf.d/default.conf -COPY --from=builder /app/${APP_PATH}/dist /usr/share/nginx/html + +# Copy Next.js build output if it exists +RUN if [ -d "/app/${APP_PATH}/.next" ]; then \ + COPY --from=builder /app/${APP_PATH}/.next /usr/share/nginx/html/.next && \ + COPY --from=builder /app/${APP_PATH}/public /usr/share/nginx/html/public 2>/dev/null || true; \ + else \ + COPY --from=builder /app/${APP_PATH}/dist /usr/share/nginx/html; \ + fi + EXPOSE 80 CMD ["nginx", "-g", "daemon off;"]