Skip to content

Commit 41490bb

Browse files
committed
chore(build): publish also on dockerhub
1 parent 442c950 commit 41490bb

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

.github/workflows/docker-image.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,12 @@ on:
99
branches: [ orange-master ]
1010
workflow_dispatch:
1111

12+
1213
env:
1314
DOCKER_FILE_PATH: .
1415
IMAGE: "ghcr.io/${{ github.repository }}"
16+
DOCKERHUB_ORG: elpaasoci
17+
1518
jobs:
1619
build_and_publish:
1720
name: build and publish
@@ -21,21 +24,34 @@ jobs:
2124

2225
steps:
2326
- uses: actions/checkout@v4
27+
-
28+
name: Login to DockerHub
29+
uses: docker/login-action@v3
30+
with:
31+
username: ${{ secrets.DOCKERHUB_USERNAME }}
32+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
2433
-
2534
name: Login to GitHub Container Registry
2635
uses: docker/login-action@v3
2736
with:
2837
registry: ghcr.io
2938
username: ${{ github.actor }}
3039
password: ${{ secrets.GITHUB_TOKEN }}
31-
40+
-
41+
name: extract github repo name
42+
id: gh-repo-name
43+
run: |
44+
echo "OCI_IMAGE=$(basename ${{ github.repository }})" >> $GITHUB_ENV
45+
shell: bash
3246
-
3347
name: publish image
3448
uses: docker/build-push-action@v5.1.0
3549
with:
3650
context: ${{env.DOCKER_FILE_PATH}}
3751
push: true
3852
tags: |
53+
${{env.DOCKERHUB_ORG}}/${{env.OCI_IMAGE}}:latest
54+
${{env.DOCKERHUB_ORG}}/${{env.OCI_IMAGE}}:${{github.sha}}
3955
${{ env.IMAGE}}:latest
4056
${{ env.IMAGE}}:${{github.sha}}
4157
-
@@ -46,4 +62,5 @@ jobs:
4662
push: true
4763
context: ${{ env.DOCKER_FILE_PATH }}
4864
tags: |
49-
${{ env.IMAGE}}:${{github.ref_name}}
65+
${{env.DOCKERHUB_ORG}}/${{env.OCI_IMAGE}}:${{github.ref_name}}
66+
${{env.IMAGE}}:${{github.ref_name}}

0 commit comments

Comments
 (0)