From c20b2b1996ee090507f7f480f7d8cc719aa28b7f Mon Sep 17 00:00:00 2001 From: Andrew Kostka Date: Sat, 8 Jun 2024 09:53:19 +0000 Subject: [PATCH] Automate Docker builds using GitHub actions --- .github/workflows/docker-build.yaml | 38 +++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/docker-build.yaml diff --git a/.github/workflows/docker-build.yaml b/.github/workflows/docker-build.yaml new file mode 100644 index 0000000..7295a24 --- /dev/null +++ b/.github/workflows/docker-build.yaml @@ -0,0 +1,38 @@ +name: Build and publish Docker image + +on: + push: + +jobs: + build-and-push-image: + runs-on: ubuntu-latest + + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4.1.6 + + - name: Log in to the Container registry + uses: docker/login-action@v3.2.0 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata for Docker + id: meta + uses: docker/metadata-action@v5.5.1 + with: + images: ghcr.io/${{ github.repository }} + tags: | + type=raw,value={{sha}} + + - name: Build and push Docker image + uses: docker/build-push-action@v5.3.0 + with: + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }}