Pritunl-Zero and Bastion multiarch package #50
This file contains 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: Pritunl-Zero and Bastion multiarch package | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
type: string | |
description: Version without the v prefix | |
required: true | |
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/ | |
push: | |
runs-on: ubuntu-latest | |
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 | |
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 | |
BASTION_IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$BASTION_IMAGE_NAME | |
# 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]') | |
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes | |
docker buildx create --name builder --driver docker-container --use | |
docker buildx inspect --bootstrap | |
# 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 $BASTION_IMAGE_ID:latest \ | |
--push \ | |
--label "runnumber=${GITHUB_RUN_ID}" |