From 39996ab0a29ebcc91e4e1c1b1b62ad5fd46cb16b Mon Sep 17 00:00:00 2001 From: weidi Date: Mon, 10 Feb 2025 21:16:41 +0100 Subject: [PATCH 1/2] build arm and x86 as one tag --- .github/workflows/docker-aio.yml | 57 ++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 .github/workflows/docker-aio.yml diff --git a/.github/workflows/docker-aio.yml b/.github/workflows/docker-aio.yml new file mode 100644 index 00000000..277747b0 --- /dev/null +++ b/.github/workflows/docker-aio.yml @@ -0,0 +1,57 @@ +name: docker-aio + +on: + push: + branches: + - 'master' + tags: + - '*' + pull_request: + workflow_dispatch: + +jobs: + docker: + strategy: + matrix: + distribution : [vpnclient, vpnserver, vpnbridge] + + name: docker-${{ matrix.distribution }} + runs-on: ubuntu-latest + if: ${{ github.repository_owner == 'SoftEtherVPN' }} + steps: + - + name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: softethervpn/${{ matrix.distribution }} + tags: | + type=raw,value=latest,enable={{is_default_branch}} + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + - + name: Set up QEMU + uses: docker/setup-qemu-action@v3 + with: + image: tonistiigi/binfmt:qemu-v9.2.0 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - + name: Login to DockerHub + if: ${{ github.event_name != 'pull_request' }} + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - + name: Build and push + uses: docker/build-push-action@v6 + with: + file: ./Dockerfile + target: ${{ matrix.distribution }} + push: ${{ github.event_name != 'pull_request' }} + platforms: linux/amd64,linux/arm64 + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file From 591cf0e9b9f2e673b0e3a9924970f2bb27e32a39 Mon Sep 17 00:00:00 2001 From: weidi Date: Mon, 10 Feb 2025 21:40:34 +0100 Subject: [PATCH 2/2] run all build sequentially, should help with caching layers --- .github/workflows/docker-aio.yml | 59 ++++++++++++++++++++++++++------ 1 file changed, 48 insertions(+), 11 deletions(-) diff --git a/.github/workflows/docker-aio.yml b/.github/workflows/docker-aio.yml index 277747b0..b121d00d 100644 --- a/.github/workflows/docker-aio.yml +++ b/.github/workflows/docker-aio.yml @@ -11,20 +11,37 @@ on: jobs: docker: - strategy: - matrix: - distribution : [vpnclient, vpnserver, vpnbridge] - - name: docker-${{ matrix.distribution }} + name: docker-aio runs-on: ubuntu-latest - if: ${{ github.repository_owner == 'SoftEtherVPN' }} steps: - - name: Docker meta - id: meta + name: Docker meta vpnserver + id: metavpnserver uses: docker/metadata-action@v5 with: - images: softethervpn/${{ matrix.distribution }} + images: softethervpn/vpnserver + tags: | + type=raw,value=latest,enable={{is_default_branch}} + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + - + name: Docker meta vpnclient + id: metavpnclient + uses: docker/metadata-action@v5 + with: + images: softethervpn/vpnclient + tags: | + type=raw,value=latest,enable={{is_default_branch}} + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + - + name: Docker meta vpnbridge + id: metavpnbridge + uses: docker/metadata-action@v5 + with: + images: softethervpn/vpnbridge tags: | type=raw,value=latest,enable={{is_default_branch}} type=ref,event=pr @@ -46,11 +63,31 @@ jobs: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build and push + name: Build and push vpnserver uses: docker/build-push-action@v6 with: file: ./Dockerfile - target: ${{ matrix.distribution }} + target: vpnserver + push: ${{ github.event_name != 'pull_request' }} + platforms: linux/amd64,linux/arm64 + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + - + name: Build and push vpnclient + uses: docker/build-push-action@v6 + with: + file: ./Dockerfile + target: vpnclient + push: ${{ github.event_name != 'pull_request' }} + platforms: linux/amd64,linux/arm64 + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + - + name: Build and push vpnbridge + uses: docker/build-push-action@v6 + with: + file: ./Dockerfile + target: vpnbridge push: ${{ github.event_name != 'pull_request' }} platforms: linux/amd64,linux/arm64 tags: ${{ steps.meta.outputs.tags }}