# Build + publish the media-box container image to the GitHub Container Registry. # # Publishes linux/amd64 (Unraid's arch) so the image runs natively there — a bare # `docker build` on an Apple-Silicon Mac produces an arm64 image that fails on # amd64 Unraid with "exec format error". better-sqlite3 + sharp compile per-arch, # so building for the target arch is what makes them load correctly. # # Auth: no manual secret needed. The job's built-in GITHUB_TOKEN pushes to # ghcr.io/devblaze/media-box thanks to `permissions: packages: write` below. # # NOTE: after the first successful run, the ghcr package defaults to PRIVATE. # Make it public (github.com/users/devblaze/packages/container/media-box/settings # → Change visibility → Public) so Unraid can pull it without a docker login. name: docker-publish on: push: branches: [main] tags: ["v*"] workflow_dispatch: permissions: contents: read packages: write jobs: # Same checks as ci.yml — the image only builds when they pass. test: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Set up Node uses: actions/setup-node@v4 with: node-version: 22 cache: yarn - name: Install dependencies run: yarn install --frozen-lockfile - name: Generate Next types run: npx next typegen - name: Typecheck run: npx tsc --noEmit - name: Tests run: yarn test build-and-push: needs: test runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Set up QEMU uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Log in to GHCR uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Docker metadata (tags + labels) id: meta uses: docker/metadata-action@v5 with: images: ghcr.io/devblaze/media-box tags: | type=raw,value=latest,enable={{is_default_branch}} type=ref,event=tag type=sha,format=short - name: Build and push (linux/amd64) uses: docker/build-push-action@v6 with: context: . platforms: linux/amd64 push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max