Skip to content

Commit a338817

Browse files
Merge pull request #5 from gomessguii/develop
chore(workflows): update Docker image workflow to support Docker Hub
2 parents 2bbe2c9 + 139497e commit a338817

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

.github/workflows/docker-image.yml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ on:
77
branches: ["main", "develop"]
88

99
env:
10-
REGISTRY: ghcr.io
10+
GHCR_REGISTRY: ghcr.io
11+
DOCKERHUB_REGISTRY: docker.io
1112
IMAGE_NAME: ${{ github.repository }}
13+
DOCKERHUB_IMAGE: ${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }}
1214

1315
jobs:
1416
build-and-push:
@@ -21,18 +23,27 @@ jobs:
2123
- name: Checkout repository
2224
uses: actions/checkout@v4
2325

24-
- name: Log in to the Container registry
26+
- name: Log in to GitHub Container Registry
2527
uses: docker/login-action@v3
2628
with:
27-
registry: ${{ env.REGISTRY }}
29+
registry: ${{ env.GHCR_REGISTRY }}
2830
username: ${{ github.actor }}
2931
password: ${{ secrets.GITHUB_TOKEN }}
32+
33+
- name: Log in to Docker Hub
34+
uses: docker/login-action@v3
35+
with:
36+
registry: ${{ env.DOCKERHUB_REGISTRY }}
37+
username: ${{ secrets.DOCKERHUB_USERNAME }}
38+
password: ${{ secrets.DOCKERHUB_TOKEN }}
3039

31-
- name: Extract metadata (tags, labels) for Docker
40+
- name: Extract metadata for Docker
3241
id: meta
3342
uses: docker/metadata-action@v5
3443
with:
35-
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
44+
images: |
45+
${{ env.GHCR_REGISTRY }}/${{ env.IMAGE_NAME }}
46+
${{ env.DOCKERHUB_REGISTRY }}/${{ env.DOCKERHUB_IMAGE }}
3647
tags: |
3748
type=raw,value=develop,enable=${{ github.ref == format('refs/heads/{0}', 'develop') }}
3849
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}

0 commit comments

Comments
 (0)