|
| 1 | +name: Docker-Multi-Arch |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ "main" ] |
| 6 | + workflow_dispatch: |
| 7 | + inputs: |
| 8 | + tagName: |
| 9 | + description: 'Tag Name' |
| 10 | + required: true |
| 11 | + default: 'latest' |
| 12 | + |
| 13 | +jobs: |
| 14 | + build: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + name: build for amd64/arm64 |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v2 |
| 19 | + with: |
| 20 | + submodules: recursive |
| 21 | + #- name : Checkout Branch |
| 22 | + # if: github.event.inputs.tagName != '' |
| 23 | + # run: | |
| 24 | + # git fetch --all --tags |
| 25 | + # git checkout ${{ github.event.inputs.tagName }} |
| 26 | + |
| 27 | + - name: Login to GitHub Container Registry |
| 28 | + uses: docker/login-action@v1 |
| 29 | + with: |
| 30 | + registry: ghcr.io |
| 31 | + username: ${{ github.actor }} |
| 32 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 33 | + |
| 34 | + # Setup hardware emulator using QEMU |
| 35 | + - name: Set up QEMU |
| 36 | + uses: docker/setup-qemu-action@v2 |
| 37 | + |
| 38 | + # Setup Docker Buildx for multi-arch images |
| 39 | + - name: Set up Docker Buildx |
| 40 | + uses: docker/setup-buildx-action@v2 |
| 41 | + |
| 42 | + - name: Build Check |
| 43 | + if: | |
| 44 | + github.repository != 'loxilb-io/loxilb-ingress' |
| 45 | + uses: docker/build-push-action@v4 |
| 46 | + with: |
| 47 | + context: . |
| 48 | + platforms: linux/amd64, linux/arm64 |
| 49 | + push: false |
| 50 | + tags: ghcr.io/loxilb-io/loxilb-ingress:latest |
| 51 | + |
| 52 | + - name: Build and push to latest |
| 53 | + if: | |
| 54 | + github.repository == 'loxilb-io/loxilb-ingress' |
| 55 | + && github.event.inputs.tagName == '' |
| 56 | + uses: docker/build-push-action@v4 |
| 57 | + with: |
| 58 | + context: . |
| 59 | + platforms: linux/amd64, linux/arm64 |
| 60 | + push: true |
| 61 | + tags: ghcr.io/loxilb-io/loxilb-ingress:latest |
| 62 | + |
| 63 | + - name: Build and push to given tag |
| 64 | + if: | |
| 65 | + github.repository == 'loxilb-io/loxilb-ingress' |
| 66 | + && github.event.inputs.tagName != '' |
| 67 | + uses: docker/build-push-action@v4 |
| 68 | + with: |
| 69 | + context: . |
| 70 | + platforms: linux/amd64, linux/arm64 |
| 71 | + push: true |
| 72 | + build-args: TAG=${{ github.event.inputs.tagName }} |
| 73 | + tags: ghcr.io/loxilb-io/loxilb-ingress:${{ github.event.inputs.tagName }} |
0 commit comments