From e15f335a64ab43968640893486ad49850bcb4ac0 Mon Sep 17 00:00:00 2001 From: Tjaart van der Walt Date: Fri, 18 Aug 2023 01:13:32 -0700 Subject: [PATCH] Add docker build (#295) --- .github/workflows/docker-build.yml | 46 ++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/docker-build.yml diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml new file mode 100644 index 0000000..a8e1ef8 --- /dev/null +++ b/.github/workflows/docker-build.yml @@ -0,0 +1,46 @@ +name: Docker build +on: + push: + branches: + - master + release: + types: [published] + +jobs: + docker-build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Set Image tag + run: | + if [[ "${{ github.ref_name }}" == "master" ]]; then + echo "TAG=latest" >> "$GITHUB_ENV" + else + echo "TAG=${{ github.ref_name }}" >> "$GITHUB_ENV" + fi + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to Github Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ github.token }} + + - name: Build and push + uses: docker/build-push-action@v3 + with: + context: . + file: Dockerfile.latest + platforms: linux/amd64,linux/arm64 + push: true + cache-from: type=registry,ref=ghcr.io/${{ github.repository }}:${{ env.TAG }} + cache-to: type=inline + tags: ghcr.io/${{ github.repository }}:${{ env.TAG }}