Skip to content

Commit

Permalink
ci(feature): add secondary docker image repo - ghcr.io (#5174)
Browse files Browse the repository at this point in the history
Description
Add GitHub Container Registry as a secondary docker image repo

Motivation and Context
Having a secondary docker image repo for redundancy is never bad

How Has This Been Tested?
Built with GHA in local fork
  • Loading branch information
leet4tari authored Feb 13, 2023
1 parent 2198df9 commit 00b08ff
Showing 1 changed file with 31 additions and 6 deletions.
37 changes: 31 additions & 6 deletions .github/workflows/build_dockers_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,19 +158,42 @@ jobs:
fi
fi
- name: Set up QEMU for Docker
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: |
#name/${{ matrix.builds.image_name }}
#ghcr.io/${{ github.repository }}
ghcr.io/${{ github.repository_owner }}/${{ matrix.builds.image_name }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
#username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Login to Docker Image Provider
uses: docker/login-action@v2
with:
registry: ${{ secrets.DOCKER_PROVIDER }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Set up QEMU for Docker
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Docker image build and push
id: docker_build
uses: docker/build-push-action@v4
Expand All @@ -189,8 +212,10 @@ jobs:
APP_EXEC=${{ matrix.builds.app_exec }}
${{ env.DOCKER_SUBTAG }}
tags: |
${{ steps.meta.outputs.tags }}
${{ secrets.DOCKER_PROVIDER }}/${{ secrets.DOCKER_REPO }}/${{ matrix.builds.image_name }}:${{ env.VERSION }}
${{ env.TAG_ALIAS }}
labels: ${{ steps.meta.outputs.labels }}

- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}

0 comments on commit 00b08ff

Please sign in to comment.