Skip to content

Commit

Permalink
x86/arm build
Browse files Browse the repository at this point in the history
  • Loading branch information
jmshrv committed Sep 25, 2023
1 parent 4528411 commit 9215302
Showing 1 changed file with 17 additions and 19 deletions.
36 changes: 17 additions & 19 deletions .github/workflows/container-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,23 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Build image
run: docker build . --file Dockerfile --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}"
- name: Set up QEMU
run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes

- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
#
- name: Push image
- name: Build and push x86-64 image
run: |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
docker build . --file Dockerfile --tag $IMAGE_NAME-x86_64 --label "runnumber=${GITHUB_RUN_ID}"
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
docker push ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME-x86_64:latest
# This changes all uppercase characters to lowercase.
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# This strips the git ref prefix from the version.
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# This strips the "v" prefix from the tag name.
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# This uses the Docker `latest` tag convention.
[ "$VERSION" == "main" ] && VERSION=latest
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
- name: Build and push ARM64 image
run: |
docker build . --file Dockerfile --tag $IMAGE_NAME-arm64 --label "runnumber=${GITHUB_RUN_ID}" --build-arg ARCH=arm64
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
docker push ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME-arm64:latest
- name: Create manifest list
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
docker manifest create ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME:latest ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME-x86_64:latest ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME-arm64:latest
docker manifest push --purge ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME:latest

0 comments on commit 9215302

Please sign in to comment.