From d8c76046d8b8385c46aca6db705745d94099663d Mon Sep 17 00:00:00 2001 From: James Chapman Date: Mon, 24 Jul 2023 16:06:07 +0100 Subject: [PATCH] Add workflow to build and push Docker image to GitHub Container Registry --- .github/workflows/docker-image.yml | 34 ++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/docker-image.yml diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 0000000..ba28ac3 --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,34 @@ +name: Docker Image CI + +on: + push: + branches: [ "main" ] + +jobs: + build: + runs-on: ubuntu-latest + + permissions: + contents: read + packages: write + + steps: + - uses: actions/checkout@v3 + + - uses: docker/login-action@v2.2.0 + with: + registry: ghcr.io + username: ${{github.actor}} + password: ${{secrets.GITHUB_TOKEN}} + + - uses: docker/metadata-action@v4.6.0 + id: meta + with: + images: ghcr.io/groceries + + - uses: docker/build-push-action@v4.1.1 + with: + context: . + push: true + tags: ${{steps.meta.outputs.tags}} + labels: ${{steps.meta.outputs.labels}}