From 41490bb858f7314bf779e976a25bf83e0597bb48 Mon Sep 17 00:00:00 2001 From: Olivier ORAND Date: Wed, 13 Mar 2024 11:30:44 +0000 Subject: [PATCH] chore(build): publish also on dockerhub --- .github/workflows/docker-image.yml | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 88b8073..c22de6b 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -9,9 +9,12 @@ on: branches: [ orange-master ] workflow_dispatch: + env: DOCKER_FILE_PATH: . IMAGE: "ghcr.io/${{ github.repository }}" + DOCKERHUB_ORG: elpaasoci + jobs: build_and_publish: name: build and publish @@ -21,6 +24,12 @@ jobs: steps: - uses: actions/checkout@v4 + - + name: Login to DockerHub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_PASSWORD }} - name: Login to GitHub Container Registry uses: docker/login-action@v3 @@ -28,7 +37,12 @@ jobs: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - + - + name: extract github repo name + id: gh-repo-name + run: | + echo "OCI_IMAGE=$(basename ${{ github.repository }})" >> $GITHUB_ENV + shell: bash - name: publish image uses: docker/build-push-action@v5.1.0 @@ -36,6 +50,8 @@ jobs: context: ${{env.DOCKER_FILE_PATH}} push: true tags: | + ${{env.DOCKERHUB_ORG}}/${{env.OCI_IMAGE}}:latest + ${{env.DOCKERHUB_ORG}}/${{env.OCI_IMAGE}}:${{github.sha}} ${{ env.IMAGE}}:latest ${{ env.IMAGE}}:${{github.sha}} - @@ -46,4 +62,5 @@ jobs: push: true context: ${{ env.DOCKER_FILE_PATH }} tags: | - ${{ env.IMAGE}}:${{github.ref_name}} + ${{env.DOCKERHUB_ORG}}/${{env.OCI_IMAGE}}:${{github.ref_name}} + ${{env.IMAGE}}:${{github.ref_name}}