Skip to content

Commit

Permalink
WIP: Building docker image for arm64
Browse files Browse the repository at this point in the history
  • Loading branch information
erikbra committed Jul 24, 2024
1 parent 6b2a1e9 commit f921af2
Showing 1 changed file with 49 additions and 15 deletions.
64 changes: 49 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
uses: gittools/actions/gitversion/[email protected]

build-netcore-tool:
if: false
needs: set-version-number
name: Build .NET Core (global) tool

Expand Down Expand Up @@ -68,6 +69,7 @@ jobs:
run: dotnet nuget push /tmp/grate/nupkg/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{secrets.NUGET_ORG_KEY}} --skip-duplicate

build-nuget-package:
if: false
needs: set-version-number
name: Build Nuget

Expand Down Expand Up @@ -103,6 +105,7 @@ jobs:
run: dotnet nuget push /tmp/grate/nupkg/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{secrets.NUGET_ORG_KEY}} --skip-duplicate

build-standalone:
if: false
name: Build cli
needs: set-version-number

Expand Down Expand Up @@ -135,6 +138,7 @@ jobs:


build-standalone-mac-arm64:
if: false
name: Build cli
needs: set-version-number

Expand Down Expand Up @@ -199,30 +203,29 @@ jobs:
name: grate-msi-${{ matrix.arch }}-${{ needs.set-version-number.outputs.nuGetVersion }}
path: ./installers/msi/tmp/*.msi

build-docker-image:
name: Build and push docker image
build-docker-images:
name: Build and push docker images
needs:
- set-version-number
#- build-standalone ## no need, we build directly from source
runs-on: ubuntu-latest
if: ${{ needs.set-version-number.outputs.is-release == 'true' }}
#if: ${{ needs.set-version-number.outputs.is-release == 'true' }}
env:
#REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
FULL_IMAGE_NAME: ${{ github.repository }}

strategy:
matrix:
arch:
- amd64
- arm64

steps:
- uses: actions/checkout@v4
# - uses: actions/download-artifact@v4 # download from another artifact is not a good idea, we need to build directly from source
# with:
# name: grate-linux-musl-x64-self-contained-${{ needs.set-version-number.outputs.nuGetVersion }}
# path: installers/docker/


- name: Log in to the Container registry
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567
with:
#registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner}}
password: ${{ secrets.DOCKER_HUB_TOKEN }}

Expand All @@ -232,22 +235,52 @@ jobs:
with:
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{version}},value=${{ needs.set-version-number.outputs.semVer }}
type=semver,pattern={{version}},value=${{ needs.set-version-number.outputs.semVer }}-${{ matrix.arch }}
type=ref,event=tag
#images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
images: ${{ env.IMAGE_NAME }}


- name: Build and push Docker image
- name: Build Docker images
uses: docker/build-push-action@5176d81f87c23d6fc96624dfdbcd9f3830bbe445
with:
file: ./installers/docker/Dockerfile
context: .
push: true
push: false
build-args:
arch=${{ matrix.arch }}
platforms: linux/${{ matrix.arch }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

create-docker-manifests:
name: Create and push combined docker images
needs:
- set-version-number
runs-on: ubuntu-latest
#if: ${{ needs.set-version-number.outputs.is-release == 'true' }}
env:
REGISTRY: docker.io
IMAGE_NAME: ${{ github.repository }}

strategy:
matrix:
arch:
- amd64
- arm64

steps:

- name: Create combined docker manifest
run: |
docker manifest create "$REGISTRY/${IMAGE_NAME}:$TAG" "$registry/${image}:$TAG-x64" "$registry/${image}:$TAG-arm64"
docker manifest push "$REGISTRY/${IMAGE_NAME}:$TAG"
env:
REGISTRY: docker.io
IMAGE_NAME: ${{ env.IMAGE_NAME }}
TAG: ${{ needs.set-version-number.outputs.semVer }}


build-deb:
name: Build Debian package
needs:
Expand Down Expand Up @@ -286,6 +319,7 @@ jobs:

test:
name: Run tests
if: false

runs-on: ubuntu-latest
strategy:
Expand Down

0 comments on commit f921af2

Please sign in to comment.