-
Notifications
You must be signed in to change notification settings - Fork 1
56 lines (52 loc) · 2.12 KB
/
docker-image.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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}"