name: Build Builder Docker Image on: push: tags: - builder-* jobs: create-builder-docker-image: runs-on: ubuntu-latest container: image: docker:28.3.2-dind steps: - name: Checkout repository run: | # Install git apk add --no-cache git echo "=== GitHub Variables ===" echo "github.ref = ${{ github.ref }}" echo "github.ref_name = ${{ github.ref_name }}" echo "github.sha = ${{ github.sha }}" echo "github.repository = ${{ github.repository }}" echo "========================" echo "Cloning..." git clone https://oauth2:${{ secrets.GITEATOKEN }}@direct-dev.ru/gitea/GiteaAdmin/hello_gitea.git hello_gitea cd hello_gitea echo "Checkout to ${{ github.ref }} ..." git checkout ${{ github.ref }} - name: Setup Docker Buildx run: | # Docker is already installed in docker:dind image echo "look at docker version" docker --version # Setup Docker Buildx for multi-platform builds echo "setup buildx" docker buildx create --name builder-builx --use docker buildx inspect --bootstrap - name: Login to Docker Hub run: | echo "login to docker hub ..." echo ${{ secrets.DOCKERHUB_TOKEN }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin - name: Build multi-platform Docker images run: | cd hello_gitea echo "Build multi-platform images using buildx ..." docker buildx build \ --platform linux/amd64,linux/arm64 \ --tag ${{ secrets.DOCKERHUB_USERNAME }}/my-build-golang-runner:${{ github.ref_name }} \ --tag ${{ secrets.DOCKERHUB_USERNAME }}/my-build-golang-runner:latest \ --push \ -f Dockerfile.builder \ . - name: Remove buildx run: | docker buildx rm builder-builx