From 1e51da1cf2ff64dbf30fff0c86287fba26f8e8f8 Mon Sep 17 00:00:00 2001 From: Olivier ORAND Date: Wed, 13 Mar 2024 11:09:36 +0000 Subject: [PATCH] chore(build): publish also on dockerhub --- .github/workflows/docker-image.yml | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 8121057..9dec8ac 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -12,6 +12,7 @@ on: env: DOCKER_FILE_PATH: "fly" IMAGE: "ghcr.io/${{github.repository_owner}}/concourse-fly" + DOCKERHUB_ORG: elpaasoci jobs: build_and_publish: name: build and publish @@ -21,6 +22,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 +35,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 +48,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 +60,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}}