From 62bd3658bfc7e9bf863f522e9efabd7410ec0b71 Mon Sep 17 00:00:00 2001 From: pataquets Date: Wed, 21 Sep 2022 19:06:28 +0200 Subject: [PATCH] Add 'Publish Docker image' Github Action. Enable Dependabot for it. --- .github/dependabot.yml | 7 ++++ .github/workflows/docker-publish.yml | 49 ++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/docker-publish.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..2c7d170 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,7 @@ +version: 2 +updates: + # Maintain dependencies for GitHub Actions + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 0000000..85c4f69 --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -0,0 +1,49 @@ +name: Publish Docker image + +on: push + +jobs: + buildx: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }} + # generate Docker tags based on the following events/attributes + tags: | + type=ref,event=branch + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + + # Required if building multi-arch images + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - id: buildx + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + with: + buildkitd-flags: --debug + install: true + + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v3 + with: + platforms: linux/amd64,linux/arm64,linux/386 + push: true + labels: ${{ steps.meta.outputs.labels }} + tags: ${{ steps.meta.outputs.tags }} + cache-from: type=gha + cache-to: type=gha,mode=max