diff --git a/.gitea/workflows/docker-build-base.yaml b/.gitea/workflows/docker-build-base.yaml index c632a02..a92894c 100644 --- a/.gitea/workflows/docker-build-base.yaml +++ b/.gitea/workflows/docker-build-base.yaml @@ -344,10 +344,28 @@ jobs: export DOCKER_BUILDKIT=1 - docker build -f Dockerfile.cicd-base \ + BUILD_TIMEOUT_SECONDS=5400 + BUILD_START_EPOCH=$(date +%s) + echo "docker_build_timeout_seconds=${BUILD_TIMEOUT_SECONDS}" + echo "docker_build_started_utc=$(date -u +%Y-%m-%dT%H:%M:%SZ)" + + timeout "${BUILD_TIMEOUT_SECONDS}" docker build --progress=plain -f Dockerfile.cicd-base \ --build-arg BASE_IMAGE_VERSION="v1.0.0-${BASE_HASH}" \ --build-arg BASE_IMAGE_HASH="${BASE_HASH}" \ -t cicd-base:latest . + BUILD_EXIT_CODE=$? + if [ "${BUILD_EXIT_CODE}" -ne 0 ]; then + if [ "${BUILD_EXIT_CODE}" -eq 124 ]; then + echo "❌ docker build timed out after ${BUILD_TIMEOUT_SECONDS}s" + else + echo "❌ docker build failed with exit code ${BUILD_EXIT_CODE}" + fi + exit "${BUILD_EXIT_CODE}" + fi + + BUILD_END_EPOCH=$(date +%s) + BUILD_ELAPSED=$((BUILD_END_EPOCH - BUILD_START_EPOCH)) + echo "docker_build_elapsed_seconds=${BUILD_ELAPSED}" ARCHIVE_PATH="/tmp/cicd-base.tar" source /tmp/registry-push-helpers.sh diff --git a/Dockerfile.cicd-base b/Dockerfile.cicd-base index 2ac146b..05ef821 100644 --- a/Dockerfile.cicd-base +++ b/Dockerfile.cicd-base @@ -131,14 +131,39 @@ RUN echo "=== Installing Global Development Tools ===" && \ which prettier && \ echo "✓ Global Node.js development tools installed via npm" -# Install Playwright browsers for E2E testing -# This downloads ~400MB+ of browser binaries that will be cached -RUN echo "=== Installing Playwright Browsers ===" && \ - # Verify Playwright CLI is available - playwright --version && \ - # Only install chromium — CI playwright.config.ts only uses chromium - playwright install --with-deps chromium && \ - echo "✓ Playwright browsers installed and cached in base image" +# Install Playwright browser runtime in bounded, retryable phases. +# Splitting deps/browser install gives better logs and avoids long silent hangs. +RUN set -eu && \ + echo "=== Installing Playwright Browsers ===" && \ + playwright --version && \ + deps_ok=0 && \ + for i in 1 2 3; do \ + echo "Attempt $i: playwright system dependencies"; \ + if timeout 900 playwright install-deps chromium; then \ + deps_ok=1; \ + break; \ + fi; \ + if [ "$i" -lt 3 ]; then \ + echo "Attempt $i failed for install-deps, retrying in 15s"; \ + sleep 15; \ + fi; \ + done && \ + [ "$deps_ok" -eq 1 ] || (echo "❌ playwright install-deps failed after 3 attempts" && exit 1) && \ + browser_ok=0 && \ + for i in 1 2 3; do \ + echo "Attempt $i: playwright chromium browser"; \ + if timeout 1200 playwright install chromium; then \ + browser_ok=1; \ + break; \ + fi; \ + if [ "$i" -lt 3 ]; then \ + echo "Attempt $i failed for browser install, retrying in 20s"; \ + sleep 20; \ + fi; \ + done && \ + [ "$browser_ok" -eq 1 ] || (echo "❌ playwright browser install failed after 3 attempts" && exit 1) && \ + playwright install --list && \ + echo "✓ Playwright browsers installed and cached in base image" # Pre-install common Python development dependencies globally # These are stable tools that rarely change and take time to compile