Docker Image CI #11
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: Docker Image CI | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
buildx: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
platform: | |
- linux/amd64 | |
- linux/arm64 | |
steps: | |
- name: Prepare | |
run: | | |
platform=${{ matrix.platform }} | |
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV | |
- | |
name: Checkout | |
uses: actions/checkout@v4 | |
- | |
# Add support for more platforms with QEMU (optional) | |
# https://github.com/docker/setup-qemu-action | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: ${{ matrix.platform }} | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
push: false | |
load: true | |
platforms: ${{ matrix.platform }} | |
tags: "softether:latest" | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Save Docker image as tar.xz | |
run: docker save softether:latest > softether_$PLATFORM_PAIR.tar && xz -kv9T0 softether_$PLATFORM_PAIR.tar && echo "FILENAME=softether_$PLATFORM_PAIR.tar.xz" >>$GITHUB_ENV | |
- name: Upload Docker image artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.FILENAME }} | |
path: ${{ env.FILENAME }} | |
compression-level: 0 |