name: docker-dryrun
description: Composite action that performs the container build steps for a single platform.

inputs:
  platform:
    description: "The target platform: linux/amd64, linux/arm64, linux/riscv64."
    required: true

runs:
  using: composite
  steps:
    - uses: docker/setup-qemu-action@06116385d9baf250c9f4dcb4858b16962ea869c3 # v4.1.0
    - uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
    - name: Build regular image
      uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0
      with:
        context: .
        platforms: ${{ inputs.platform }}
        push: false
        file: Dockerfile
        cache-from: type=registry,ref=ghcr.io/go-gitea/gitea:buildcache-rootful
    - name: Build rootless image
      uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0
      with:
        context: .
        platforms: ${{ inputs.platform }}
        push: false
        file: Dockerfile.rootless
        cache-from: type=registry,ref=ghcr.io/go-gitea/gitea:buildcache-rootless
