Add multi-arch Docker build for amd64 & arm64 #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: ci | ||
| on: | ||
| push: | ||
| pull_request: | ||
| create: | ||
| tags: '*' | ||
| jobs: | ||
| build: | ||
| name: Build | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: '^1.22' | ||
| - run: go install github.com/mattn/goveralls@latest | ||
| - run: | | ||
| make test | ||
| make | ||
| make build.docker | ||
| - run: | | ||
| make test | ||
| make build.linux.amd64 | ||
| make build.linux.arm64 | ||
| - run: goveralls -coverprofile=profile.cov -service=github | ||
| env: | ||
| COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| - name: Set up QEMU for multi-arch | ||
| uses: docker/setup-qemu-action@v2 | ||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v2 | ||
| - name: Log in to DockerHub | ||
| uses: docker/login-action@v2 | ||
| with: | ||
| username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
| password: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
| - name: Build & push multi-arch image (latest) | ||
| if: github.ref == 'refs/heads/master' | ||
| uses: docker/build-push-action@v3 | ||
| with: | ||
| context: . | ||
| file: Dockerfile | ||
| platforms: linux/amd64,linux/arm64 | ||
| push: true | ||
| tags: mikkeloscar/pdb-controller:latest | ||
| - name: Build & push multi-arch image (release) | ||
| if: startsWith(github.ref, 'refs/tags/') | ||
| uses: docker/build-push-action@v3 | ||
| with: | ||
| context: . | ||
| file: Dockerfile | ||
| platforms: linux/amd64,linux/arm64 | ||
| push: true | ||
| tags: | | ||
| mikkeloscar/pdb-controller:${{ github.ref_name }} | ||