Skip to content

Commit 1e51da1

Browse files
committed
chore(build): publish also on dockerhub
1 parent e7b5392 commit 1e51da1

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

.github/workflows/docker-image.yml

+17-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ on:
1212
env:
1313
DOCKER_FILE_PATH: "fly"
1414
IMAGE: "ghcr.io/${{github.repository_owner}}/concourse-fly"
15+
DOCKERHUB_ORG: elpaasoci
1516
jobs:
1617
build_and_publish:
1718
name: build and publish
@@ -21,21 +22,34 @@ jobs:
2122

2223
steps:
2324
- uses: actions/checkout@v4
25+
-
26+
name: Login to DockerHub
27+
uses: docker/login-action@v3
28+
with:
29+
username: ${{ secrets.DOCKERHUB_USERNAME }}
30+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
2431
-
2532
name: Login to GitHub Container Registry
2633
uses: docker/login-action@v3
2734
with:
2835
registry: ghcr.io
2936
username: ${{ github.actor }}
3037
password: ${{ secrets.GITHUB_TOKEN }}
31-
38+
-
39+
name: extract github repo name
40+
id: gh-repo-name
41+
run: |
42+
echo "OCI_IMAGE=$(basename ${{ github.repository }})" >> $GITHUB_ENV
43+
shell: bash
3244
-
3345
name: publish image
3446
uses: docker/[email protected]
3547
with:
3648
context: ${{env.DOCKER_FILE_PATH}}
3749
push: true
3850
tags: |
51+
${{env.DOCKERHUB_ORG}}/${{env.OCI_IMAGE}}:latest
52+
${{env.DOCKERHUB_ORG}}/${{env.OCI_IMAGE}}:${{github.sha}}
3953
${{ env.IMAGE}}:latest
4054
${{ env.IMAGE}}:${{github.sha}}
4155
-
@@ -46,4 +60,5 @@ jobs:
4660
push: true
4761
context: ${{ env.DOCKER_FILE_PATH }}
4862
tags: |
49-
${{ env.IMAGE}}:${{github.ref_name}}
63+
${{env.DOCKERHUB_ORG}}/${{env.OCI_IMAGE}}:${{github.ref_name}}
64+
${{env.IMAGE}}:${{github.ref_name}}

0 commit comments

Comments
 (0)