Skip to content

Commit

Permalink
update github remote build action to push to different container regi…
Browse files Browse the repository at this point in the history
…stry
  • Loading branch information
Eduard-Voiculescu committed Jun 3, 2024
1 parent e3352d3 commit 02be178
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions .github/workflows/docker.remotebuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
workflow_dispatch:

env:
REGISTRY: ghcr.io
REGISTRY: ${{ secrets.REGISTRY }}
IMAGE_NAME: ${{ github.repository }}

jobs:
Expand All @@ -22,12 +22,20 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3

- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
- id: "auth"
name: "Authenticate to Google Cloud"
uses: "google-github-actions/auth@v1"
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
token_format: "access_token"
workload_identity_provider: ${{ secrets.GAR_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GAR_SERVICE_ACCOUNT }}

- name: Login to GCR
uses: docker/login-action@v1
with:
registry: gcr.io
username: oauth2accesstoken
password: ${{ steps.auth.outputs.access_token }}

- name: Generate docker tags/labels from github build context
id: meta
Expand All @@ -45,10 +53,11 @@ jobs:
- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
secrets: |
"github_token=${{ secrets.GHUB_ACCESS_TOKEN }}"
context: .
file: ./Dockerfile.remotebuild
push: true
tags: ${{ steps.meta.outputs.tags }}
# org.opencontainers.image.version will match the tag name
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit 02be178

Please sign in to comment.