name: docker-dryrun

on:
  pull_request:

concurrency:
  group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
  cancel-in-progress: true

jobs:
  files-changed:
    uses: ./.github/workflows/files-changed.yml
    permissions:
      contents: read

  container:
    if: needs.files-changed.outputs.docker == 'true'
    needs: files-changed
    runs-on: ubuntu-latest
    permissions:
      contents: read
    steps:
      - uses: actions/checkout@v6
      - uses: docker/setup-qemu-action@v4
      - uses: docker/setup-buildx-action@v4
      - name: Build regular container image
        uses: docker/build-push-action@v7
        with:
          context: .
          platforms: linux/amd64,linux/arm64,linux/riscv64
          push: false
          cache-from: type=registry,ref=ghcr.io/go-gitea/gitea:buildcache-rootful
      - name: Build rootless container image
        uses: docker/build-push-action@v7
        with:
          context: .
          push: false
          platforms: linux/amd64,linux/arm64,linux/riscv64
          file: Dockerfile.rootless
          cache-from: type=registry,ref=ghcr.io/go-gitea/gitea:buildcache-rootless
