on:
  workflow_call:

jobs:
  docker:
    runs-on: ubuntu-latest
    steps:
      - name: checkout code
        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 Github packages
        uses: docker/login-action@v3
        with:
          registry: ghcr.io
          username: ${{ github.actor }}
          password: ${{ secrets.GITHUB_TOKEN }}
      - name: Extract metadata (tags, labels) for Docker
        id: meta
        uses: docker/metadata-action@v5
        with:
          images: |
            ghcr.io/symflower/eval-dev-quality
          tags: |
            type=raw,value={{ sha }}
            type=raw,value={{ branch }}
            type=raw,value=latest,enable={{ is_default_branch }}
      - name: Build and push
        uses: docker/build-push-action@v6
        with:
          context: ./
          platforms: linux/amd64
          tags: ${{ steps.meta.outputs.tags }}
          push: true
          cache-from: type=gha
          cache-to: type=gha,mode=max
