Skip to content

Commit 3dbf81c

Browse files
committed
feat: add Docker Hub to az acr release
1 parent 44fecbc commit 3dbf81c

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

.github/workflows/az_acr_release.yml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ jobs:
1616
DEV_CONTAINER_REGISTRY: ${{ vars.DEV_CONTAINER_REGISTRY }}
1717
DEV_LOGIN_USERNAME: ${{ secrets.DEV_LOGIN_USERNAME }}
1818
DEV_LOGIN_PASSWORD: ${{ secrets.DEV_LOGIN_PASSWORD }}
19+
DOCKERHUB_CONTAINER_REGISTRY: ${{ vars.DOCKERHUB_CONTAINER_REGISTRY }}
20+
DOCKERHUB_LOGIN_USERNAME: ${{ secrets.DOCKERHUB_LOGIN_USERNAME }}
21+
DOCKERHUB_LOGIN_PASSWORD: ${{ secrets.DOCKERHUB_LOGIN_PASSWORD }}
1922
IMAGE_TAG: ${{ github.event_name == 'release' && github.event.release.tag_name || github.sha }}
2023
steps:
2124
- name: Checkout repository
@@ -47,6 +50,12 @@ jobs:
4750
registry: "${{ env.DEV_CONTAINER_REGISTRY }}"
4851
username: "${{ env.DEV_LOGIN_USERNAME }}"
4952
password: "${{ env.DEV_LOGIN_PASSWORD }}"
53+
54+
- name: Log into Docker Hub registry
55+
uses: docker/login-action@v3
56+
with:
57+
username: "${{ env.DOCKERHUB_LOGIN_USERNAME }}"
58+
password: "${{ env.DOCKERHUB_LOGIN_PASSWORD }}"
5059

5160
- name: Build & Push ${{ github.event.repository.name }}:amd64
5261
if: ${{ github.event_name != 'release' }}
@@ -76,7 +85,7 @@ jobs:
7685
platform=linux/arm64
7786
label=dockerfile-path=https://github.com/${{ github.repository }}/blob/${{ github.sha }}/Dockerfile
7887
79-
- name: Build & Push ${{ github.event.repository.name }}:${{ env.IMAGE_TAG }}
88+
- name: Build & Push ${{ env.AZURE_CONTAINER_REGISTRY }}/${{ github.event.repository.name }}:${{ env.IMAGE_TAG }}
8089
uses: docker/build-push-action@v5
8190
with:
8291
cache-from: type=registry,ref=${{ env.AZURE_CONTAINER_REGISTRY }}/${{ github.event.repository.name }}:latest-cache
@@ -89,6 +98,20 @@ jobs:
8998
platform=linux/amd64
9099
label=dockerfile-path=https://github.com/${{ github.repository }}/blob/${{ github.sha }}/${{ env.DOCKERFILE }}
91100
101+
- name: Build & Push ${{ env.DOCKERHUB_CONTAINER_REGISTRY }}/${{ github.event.repository.name }}:${{ env.IMAGE_TAG }}
102+
uses: docker/build-push-action@v5
103+
if: ${{ github.event_name == 'release' }}
104+
with:
105+
cache-from: type=registry,ref=${{ env.DOCKERHUB_CONTAINER_REGISTRY }}/${{ github.event.repository.name }}:latest-cache
106+
cache-to: type=registry,ref=${{ env.DOCKERHUB_CONTAINER_REGISTRY }}/${{ github.event.repository.name }}:latest-cache,mode=max,image-manifest=true
107+
platforms: linux/amd64
108+
file: ${{ env.DOCKERFILE }}
109+
tags: ${{ env.DOCKERHUB_CONTAINER_REGISTRY }}/${{ github.event.repository.name }}:${{ env.IMAGE_TAG }}
110+
push: true
111+
build-args: |
112+
platform=linux/amd64
113+
label=dockerfile-path=https://github.com/${{ github.repository }}/blob/${{ github.sha }}/${{ env.DOCKERFILE }}
114+
92115
- name: Build & Push ${{ github.event.repository.name }}:latest
93116
uses: docker/build-push-action@v5
94117
with:

0 commit comments

Comments
 (0)