name: build-docker on: push jobs: build: name: Build Image runs-on: ubuntu-latest permissions: contents: read packages: write steps: - name: Checkout uses: actions/checkout@v3 - id: short-sha uses: benjlevesque/short-sha@v1.2 - name: Docker meta id: meta uses: docker/metadata-action@v4 with: images: | ghcr.io/netbymatt/ws4kp tags: | type=raw,priority=1000,value=latest,enable=${{ github.ref == 'refs/heads/main' }} type=ref,event=branch ${{ steps.short-sha.outputs.sha }} - name: Set up QEMU uses: docker/setup-qemu-action@v2 - name: Set up Buildx uses: docker/setup-buildx-action@v2 - name: Login to GitHub Container Registry uses: docker/login-action@v2 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Build and Push id: docker_build uses: docker/build-push-action@v3 with: context: . pull: true push: ${{ github.ref == 'refs/heads/main' }} platforms: linux/amd64,linux/arm/v7,linux/arm64/v8 tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max