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;"]