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 5580ba3 commit f1de1ac
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ on:
env:
DOCKER_FILE_PATH: .
IMAGE: "ghcr.io/${{ github.repository }}"
DOCKERHUB_ORG: elpaasoci

jobs:
build_and_publish:
name: build and publish
Expand All @@ -21,21 +23,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 +61,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 f1de1ac

Please sign in to comment.