build-docker.yaml raw

   1  name: Multiplatform Docker build & push
   2  on:
   3    push:
   4  jobs:
   5    build:
   6      env:
   7        REGISTRY: ghcr.io
   8        IMAGENAME: ${{ github.event.repository.name }}
   9        TAG: ${{ github.ref_name }}
  10      runs-on: ubuntu-22.04
  11      steps:
  12        # see https://github.com/orgs/community/discussions/25678#discussioncomment-5242449
  13        - name: Delete huge unnecessary tools folder
  14          run: rm -rf /opt/hostedtoolcache
  15        - uses: actions/checkout@v4
  16          name: Check out code
  17        - name: Install Go
  18          uses: actions/setup-go@v5
  19          with:
  20            go-version-file: "./go.mod"
  21        - name: Run tests
  22          run: mkdir frontend/dist && touch frontend/dist/tmp && go test ./...
  23        - name: Docker build
  24          if: github.actor != 'dependabot[bot]'
  25          uses: mr-smithers-excellent/docker-build-push@v6
  26          id: build
  27          with:
  28            image: ${{ env.IMAGENAME }}
  29            registry: ${{ env.REGISTRY }}
  30            multiPlatform: true
  31            platform: linux/amd64,linux/arm64
  32            username: ${{ github.repository_owner }}
  33            password: ${{ secrets.GITHUB_TOKEN }}
  34            addLatest: ${{ startsWith(github.ref, 'refs/tags/v') }}
  35            buildArgs: TAG=${{ env.TAG }}
  36