Skip to content

Commit

Permalink
chore(build): publish also on dockerhub
Browse files Browse the repository at this point in the history
  • Loading branch information
o-orand committed Mar 13, 2024
1 parent 442c950 commit 41490bb
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -21,21 +24,34 @@ 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
with:
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/[email protected]
with:
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}}
-
Expand All @@ -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}}

0 comments on commit 41490bb

Please sign in to comment.