From 3be9d8ff4f5d411968ff6443fd1f5206dae3e009 Mon Sep 17 00:00:00 2001 From: Yaron Shahrabani Date: Thu, 28 Nov 2024 14:11:13 +0200 Subject: [PATCH] Update docker-image.yml Trying some changes from Claude. --- .github/workflows/docker-image.yml | 36 ++++++++++++++---------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index f74f806..368715e 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -1,5 +1,4 @@ name: Pritunl-Zero and Bastion multiarch package - on: workflow_dispatch: inputs: @@ -7,13 +6,11 @@ on: type: string description: Version without the v prefix required: true - default: "1.0.3019.96" - + default: "1.0.3292.11" env: BASE_IMAGE_NAME: pritunl-zero BASTION_IMAGE_NAME: pritunl-bastion PTZTAG: ${{ inputs.version }} - jobs: # Push image to GitHub Packages. # See also https://docs.docker.com/docker-hub/builds/ @@ -22,18 +19,14 @@ jobs: permissions: packages: write contents: read - steps: - uses: actions/checkout@v4 - name: Set up Docker Buildx id: buildx uses: docker/setup-buildx-action@v3 - - name: Log in to registry - # This is where you will update the PAT to GITHUB_TOKEN run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin - - name: Build and push image run: | BASE_IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$BASE_IMAGE_NAME @@ -41,18 +34,23 @@ jobs: # Change all uppercase to lowercase BASE_IMAGE_ID=$(echo $BASE_IMAGE_ID | tr '[A-Z]' '[a-z]') BASTION_IMAGE_ID=$(echo $BASTION_IMAGE_ID | tr '[A-Z]' '[a-z]') - # Strip git ref prefix from version - VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') - # Strip "v" prefix from tag name - [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') - # Use Docker `latest` tag convention - [ "$VERSION" == "main" ] && VERSION=latest - echo BASE_IMAGE_ID=$BASE_IMAGE_ID - echo BASTION_IMAGE_ID=$BASTION_IMAGE_ID - echo VERSION=$VERSION + docker run --rm --privileged multiarch/qemu-user-static --reset -p yes docker buildx create --name builder --driver docker-container --use docker buildx inspect --bootstrap - docker buildx build --platform=linux/arm64,linux/amd64 . --file Dockerfile --build-arg PTZTAG=$PTZTAG --tag $BASE_IMAGE_ID:$PTZTAG --tag $BASE_IMAGE_ID:latest --push --label "runnumber=${GITHUB_RUN_ID}" + + # Build and push Pritunl Zero image with specific version and latest tags + docker buildx build --platform=linux/arm64,linux/amd64 . --file Dockerfile \ + --build-arg PTZTAG=$PTZTAG \ + --tag $BASE_IMAGE_ID:$PTZTAG \ + --tag $BASE_IMAGE_ID:latest \ + --push \ + --label "runnumber=${GITHUB_RUN_ID}" + + # Build and push Bastion image with specific version and latest tags cd bastion - docker buildx build --platform=linux/arm64,linux/amd64 . --file Dockerfile --tag $BASTION_IMAGE_ID:$PTZTAG --tag $BASE_IMAGE_ID:latest --push --label "runnumber=${GITHUB_RUN_ID}" + docker buildx build --platform=linux/arm64,linux/amd64 . --file Dockerfile \ + --tag $BASTION_IMAGE_ID:$PTZTAG \ + --tag $BASTION_IMAGE_ID:latest \ + --push \ + --label "runnumber=${GITHUB_RUN_ID}"