From 456dfa5793b0cef4dedc073baefc76a0a1d53284 Mon Sep 17 00:00:00 2001 From: Patrick Canal <56410215+Superredstone@users.noreply.github.com> Date: Mon, 14 Sep 2026 19:13:01 +0200 Subject: [PATCH] ci: add docker container push to gh Updated the Docker CI workflow to include tag support and improved structure. --- .github/workflows/docker-image.yml | 43 ++++++++++++++++++++++++------ 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index e44f9fb..2559cab 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -1,16 +1,43 @@ -name: Docker Image CI +name: Build and Push Docker Image on: push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] + branches: [main] + tags: ["v*"] + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} jobs: - build: + docker: runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: - - uses: actions/checkout@v4 - - name: Build the Docker image - run: docker build . --file Dockerfile --tag patrickcanal.it:$(date +%s) + - name: Checkout + uses: actions/checkout@v4 + + - name: Login to GHCR + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }}