Docker Image CI #682
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Docker Image CI | |
| on: | |
| push: | |
| branches: ["main"] | |
| tags: | |
| - "v*" | |
| pull_request: | |
| branches: ["main"] | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '0 0,12 * * *' | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: true | |
| permissions: | |
| id-token: write | |
| packages: write | |
| contents: read | |
| attestations: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci --legacy-peer-deps | |
| - name: Verify essential data files | |
| run: | | |
| echo "Checking for essential data files..." | |
| if [ ! -f "data/unified.json" ]; then | |
| echo "β οΈ WARNING: data/unified.json not found in repository" | |
| echo "Collections feature will not work unless this file is committed to git" | |
| echo "Consider using Git LFS for large files: git lfs track 'data/unified.json'" | |
| else | |
| echo "β data/unified.json found" | |
| fi | |
| if [ ! -f "data/franchises.json" ]; then | |
| echo "β οΈ WARNING: data/franchises.json not found" | |
| else | |
| echo "β data/franchises.json found" | |
| fi | |
| continue-on-error: true | |
| - name: Test build and verify routes | |
| run: | | |
| echo "Running test build to verify routes..." | |
| npm run build | |
| echo "Checking build output for logs routes..." | |
| if [ -d ".output/server/chunks/routes/api/logs" ]; then | |
| echo "β logs/ directory found in build" | |
| ls -la .output/server/chunks/routes/api/logs/ | |
| else | |
| echo "β CRITICAL: logs/ directory NOT in build output!" | |
| echo "Available API routes:" | |
| ls -la .output/server/chunks/routes/api/ | head -30 | |
| exit 1 | |
| fi | |
| # Verify all required route files | |
| REQUIRED=("entries.get.mjs" "errors.get.mjs" "failures.get.mjs" "success.get.mjs" "critical.get.mjs") | |
| MISSING=0 | |
| for route in "${REQUIRED[@]}"; do | |
| if [ ! -f ".output/server/chunks/routes/api/logs/$route" ]; then | |
| echo "β Missing route: logs/$route" | |
| MISSING=1 | |
| else | |
| echo "β Found route: logs/$route" | |
| fi | |
| done | |
| if [ "$MISSING" -eq 1 ]; then | |
| echo "β Build verification failed - missing required routes" | |
| exit 1 | |
| fi | |
| # Verify logs-statistics route | |
| if [ ! -f ".output/server/chunks/routes/api/logs-statistics.get.mjs" ]; then | |
| echo "β Missing route: logs-statistics.get.mjs" | |
| exit 1 | |
| else | |
| echo "β Found route: logs-statistics.get.mjs" | |
| fi | |
| echo "β All routes verified successfully" | |
| continue-on-error: false | |
| - name: Run linting | |
| run: npm run lint || true | |
| continue-on-error: true | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| id: buildx | |
| uses: docker/setup-buildx-action@v3 | |
| with: | |
| install: true | |
| driver-opts: | | |
| image=moby/buildkit:latest | |
| - name: Docker metadata for seerrbridge | |
| id: meta_seerrbridge | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: | | |
| ghcr.io/${{ github.repository_owner }}/seerrbridge | |
| tags: | | |
| type=semver,pattern={{version}} | |
| type=raw,value=latest,enable={{is_default_branch}} | |
| type=sha,prefix={{branch}}- | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| if: github.event_name != 'pull_request' | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Verify server API routes before build | |
| run: | | |
| echo "Checking server API structure..." | |
| if [ ! -d "server/api/logs" ]; then | |
| echo "β ERROR: server/api/logs directory not found!" | |
| exit 1 | |
| fi | |
| echo "β server/api/logs directory exists" | |
| ls -la server/api/logs/ | |
| if [ -f "server/api/logs.get.ts" ]; then | |
| echo "β ERROR: server/api/logs.get.ts exists! This conflicts with logs/ directory." | |
| echo "It should be renamed to logs-statistics.get.ts" | |
| exit 1 | |
| fi | |
| if [ ! -f "server/api/logs-statistics.get.ts" ]; then | |
| echo "β ERROR: server/api/logs-statistics.get.ts not found!" | |
| exit 1 | |
| fi | |
| echo "β All route files verified" | |
| - name: Build and push unified seerrbridge | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: ./Dockerfile.unified | |
| platforms: linux/amd64,linux/arm64 | |
| push: ${{ github.event_name != 'pull_request' }} | |
| tags: ${{ steps.meta_seerrbridge.outputs.tags }} | |
| labels: ${{ steps.meta_seerrbridge.outputs.labels }} | |
| provenance: mode=max | |
| sbom: true | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| build-args: | | |
| BUILDKIT_INLINE_CACHE=1 | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }} | |
| cancel-in-progress: true |