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: | 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/ diff --git a/infrastructure/docker/Dockerfile.web b/infrastructure/docker/Dockerfile.web index 7a9aeab5d..eb02e0e19 100644 --- a/infrastructure/docker/Dockerfile.web +++ b/infrastructure/docker/Dockerfile.web @@ -28,7 +28,25 @@ 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) + +# 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 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,