From 4bf943fc5a00f72ad4338ec3073a56f9c704f3cb Mon Sep 17 00:00:00 2001 From: Jeremy Thurgood Date: Tue, 30 Jul 2024 15:24:33 +0200 Subject: [PATCH] Add a github actions docker build --- .github/workflows/docker.yaml | 36 +++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/docker.yaml diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml new file mode 100644 index 0000000..9f80830 --- /dev/null +++ b/.github/workflows/docker.yaml @@ -0,0 +1,36 @@ +name: Publish Docker image +on: + push: + tags: + - "v*" + branches: + - "*" + +jobs: + docker: + name: Build Docker image and push to ghcr.io + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: docker/setup-buildx-action@v2 + - uses: docker/metadata-action@v4 + id: meta + with: + images: | + ghcr.io/${{ github.repository }} + tags: | + type=semver,pattern={{version}} + type=sha,prefix={{branch}}-,enable=${{ github.ref_type != 'tag' && !contains(github.ref_name, '/') }} + - uses: docker/login-action@v2 + name: Login to ghcr.io + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - uses: docker/build-push-action@v4 + name: Build and push image + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }}