name: docker-build

on:
  push:
    branches:
      - "main"
      - "master"
  repository_dispatch:
    types: [build]

jobs:
  docker:
    runs-on: ubuntu-latest
    steps:
      - name: Set up Docker Buildx
        uses: https://github.com/docker/setup-buildx-action@v3
      - name: Login to DockerHub
        uses: https://github.com/docker/login-action@v3
        with:
          username: ${{ secrets.DOCKERHUB_USERNAME }}
          password: ${{ secrets.DOCKERHUB_TOKEN }}
      - name: Build and push
        id: docker_build
        uses: https://github.com/docker/build-push-action@v6
        with:
          push: true
          load: true
          tags: spiretf/docker-comp-server:latest
      - name: Image digest
        run: echo ${{ steps.docker_build.outputs.digest }}
