🌐
GitHub
github.com › marketplace › actions › push-to-gcr-github-action
Push to GCR GitHub Action - GitHub Marketplace
name: Push to GCR GitHub Action on: [push] jobs: build-and-push-to-gcr: runs-on: ubuntu-latest permissions: contents: 'read' id-token: 'write' steps: - uses: actions/checkout@v5 - name: Authenticate to Google Cloud id: auth uses: google-github-actions/auth@v2 with: workload_identity_provider: projects/123123123/locations/global/workloadIdentityPools/the-workload-pool/providers/the-provider service_account: artifact-registry-writer@<PROJECT_ID>.iam.gserviceaccount.com - uses: RafikFarhad/push-to-gcr-github-action@v5 with: # gcloud_service_key: ${{ secrets.GCLOUD_SERVICE_KEY }} # can be base64 encoded or plain text || not needed if you use google-github-actions/auth registry: gcr.io project_id: my-awesome-project image_name: backend image_tag: latest,v1 dockerfile: ./docker/Dockerfile.prod context: ./docker
🌐
Medium
medium.com › @ardhanyoga › automating-docker-image-push-to-github-packages-github-container-registry-ghcr-and-google-3ffea20f595b
Automating Docker Image Push to Google Container Registry (GCR) and GitHub Container Registry (GHCR) using GitHub Action | Medium
May 16, 2022 - We can go to our GitHub Repository -> Actions -> New Workflow ... In choosing workflow template, choose Manual Workflow so we can create from scratch. ... In this example, create new workflow called “pipeline_gcr_ghcr.yml”. Below is the ...
🌐
Acaird
acaird.github.io › computers › 2020 › 02 › 11 › github-google-container-cloud-run
Using Github Actions to Build and Push Images to Google Container Registry
February 11, 2020 - My code is in Github and I wanted to be able to build images and push them to GCR automatically so that I could later deploy them to Google Cloud Run. There is some starting configuration at https://github.com/actions/starter-workflows/blob/master/ci/google.yml that is pretty good, but it includes ...
🌐
GitHub
github.com › RafikFarhad › push-to-gcr-github-action › releases
Releases · RafikFarhad/push-to-gcr-github-action
An action that build docker image and push to Google Cloud Registry and Google Artifact Registry. - RafikFarhad/push-to-gcr-github-action
Author   RafikFarhad
🌐
GitHub
github.com › marketplace › actions › gcr-build-and-push
GCR Build and Push · Actions · GitHub Marketplace · GitHub
Composite Github Action to build and push your repo/container to Google's Container Registry (GCR - gcr.io)
🌐
GitHub
github.com › RafikFarhad › push-to-gcr-github-action
GitHub - RafikFarhad/push-to-gcr-github-action: An action that build docker image and push to Google Cloud Registry and Google Artifact Registry.
name: Push to GCR GitHub Action on: [push] jobs: build-and-push-to-gcr: runs-on: ubuntu-latest permissions: contents: 'read' id-token: 'write' steps: - uses: actions/checkout@v5 - name: Authenticate to Google Cloud id: auth uses: google-github-actions/auth@v2 with: workload_identity_provider: projects/123123123/locations/global/workloadIdentityPools/the-workload-pool/providers/the-provider service_account: artifact-registry-writer@<PROJECT_ID>.iam.gserviceaccount.com - uses: RafikFarhad/push-to-gcr-github-action@v5 with: # gcloud_service_key: ${{ secrets.GCLOUD_SERVICE_KEY }} # can be base64 encoded or plain text || not needed if you use google-github-actions/auth registry: gcr.io project_id: my-awesome-project image_name: backend image_tag: latest,v1 dockerfile: ./docker/Dockerfile.prod context: ./docker
Starred by 74 users
Forked by 42 users
Languages   Shell 81.1% | Dockerfile 16.5% | C 2.4% | Shell 81.1% | Dockerfile 16.5% | C 2.4%
🌐
GitHub
github.com › RafikFarhad › push-to-gcr-github-action › blob › master › action.yaml
push-to-gcr-github-action/action.yaml at master · RafikFarhad/push-to-gcr-github-action
An action that build docker image and push to Google Cloud Registry and Google Artifact Registry. - push-to-gcr-github-action/action.yaml at master · RafikFarhad/push-to-gcr-github-action
Author   RafikFarhad
🌐
GitHub
github.com › marketplace › actions › google-cloud-container-registry-build-push
Google Cloud Container Registry Build & Push · Actions · GitHub Marketplace · GitHub
A GitHub action that builds your docker image and pushes it to Container Registry. you have enabled Container Registry in your Google Cloud project · you have a service account with Storage Admin permissions · - name: Build and publish image ...
Find elsewhere
🌐
GitHub
github.com › marketplace › actions › push-docker-gcr
Push Docker GCR · Actions · GitHub Marketplace · GitHub
Opinionated github workflow action to build a docker image from Dockerfile and push the image to Google Continer Registry. Pass all sensitive data using secrets. ... Name of the image.
🌐
GitHub
github.com › marketplace › actions › cloud-run-with-docker-build-and-push-to-gcr
Cloud Run with docker build and push to GCR · Actions · GitHub Marketplace · GitHub
An GitHub Action for deploying revisions to Google Cloud Run. ... In your actions workflow, somewhere after the step that builds gcr.io/<your-project>/<image>, insert this:
🌐
Medium
medium.com › mistergreen-engineering › uploading-a-docker-image-to-gcr-using-github-actions-92e1cdf14811
Uploading a Docker image to GCR using Github Actions | by Yannick Visbeek | MisterGreen Engineering | Medium
June 2, 2020 - # Configure docker to use the gcloud command-line tool as a credential helper - run: | gcloud auth configure-docker -q # Push image to Google Container Registry - name: Build run: |- docker push eu.gcr.io/$PROJECT_ID/$SERVICE_NAME:$GITHUB_SHA
🌐
Reddit
reddit.com › r/golang › using github actions to build an image and push to multiple repositories?
r/golang on Reddit: Using GitHub Actions to build an image and push to multiple repositories?
May 22, 2024 -

I'm attempting to push an image that's built and stored in GitHub Registory to Google Artifact Registry.

The GitHub Actions file contains:

docker build . --tag ghcr.io/myaccount/golang-docker:latest
docker push ghcr.io/myaccount/golang-docker:latest

This obviously builds and pushes it to ghcr.

I want to add an additional step to also push to AR so I've properly setup all the auth stuff in AR and the variables in the actions files:

env:
    IMAGE_NAME: 'golang-docker'
    PROJECT_ID: 'project-blablabla'
    AR_REPO_LOCATION: 'us-west1'
    AR_URL: 'us-west1-docker.pkg.dev/project-blablabla/my-ar-repo'
    SERVICE_ACCOUNT: 'github-actions-service-account@project-blablabla.iam.gserviceaccount.com' 
    WORKLOAD_IDENTITY_PROVIDER: 'projects/123456789/locations/global/workloadIdentityPools/my-app-dev-pool/providers/github-actions-provider'

Then I add

        - name: Google Auth
          id: auth
          uses: 'google-github-actions/auth@v2'
          with:
            token_format: 'access_token'
            project_id: ${{ env.PROJECT_ID }}
            service_account: ${{ env.SERVICE_ACCOUNT }}
            workload_identity_provider: ${{ env.WORKLOAD_IDENTITY_PROVIDER }}
        - name: Docker Auth
          id: docker-auth
          uses: 'docker/login-action@v1'
          with:
            username: 'oauth2accesstoken'
            password: '${{ steps.auth.outputs.access_token }}'
            registry: '${{ env.AR_REPO_LOCATION }}-docker.pkg.dev'    
        - name: Push to AR
          run: |-
            docker push "${{ env.AR_URL }}/${{ env.IMAGE_NAME }}:latest"

But it errors out at the last step with:

An image does not exist locally with the tag: us-west1-docker.pkg.dev/project-blablabla/my-ar-repo/golang-docker
The push refers to repository [us-west1-docker.pkg.dev/platform-blablabla/my-ar-repo/golang-docker]

I'm guessing it has to do with tagging of the image at the build step, but Im' not well versed in docker so I'm not sure what I'm missing. Basically, I'm trying to avoid building the image twice. I want to build it once and then push to one or more registries.

Any ideas?

🌐
GitHub
github.com › wipash › action-gcr-push
GitHub - wipash/action-gcr-push: Build, tag, and push container to Google Cloud Registry
name: Build and push to GCR on: push: branches: - master jobs: build_push_gcr: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v1 - name: Build and push to GCR uses: wipash/action-gcr-push@master env: GCLOUD_AUTH_KEY: ${{secrets.GCLOUD_AUTH_KEY}} with: image: cmsback version_tag: 1.0.2 environment: production project: central-management-system
Author   wipash
🌐
Medium
roger-that-dev.medium.com › push-code-with-github-actions-to-google-clouds-artifact-registry-60d256f8072f
Push code with GitHub Actions to Google Cloud’s Artifact Registry | by Roger Martinez | Medium
March 22, 2024 - Push code from GitHub to Google Cloud Artifact Registry (without using service account keys) with Workload Identity Federation.
🌐
YouTube
youtube.com › watch
Build a Docker Image and Publish It to GCP GCR & Artifact Registry using Github Actions - YouTube
👨‍💼📈 Mentorship/On-the-Job Support/Consulting - https://calendly.com/antonputra/youtube or me@antonputra.com▬▬▬▬▬ Experience & Location 💼 ▬▬▬▬▬► I’m a S...
Published   October 21, 2021
🌐
Ianwhitestone
ianwhitestone.work › docker-builds-gcr-github-actions
Continuous docker builds with Github Actions – Ian Whitestone
December 11, 2020 - Here’s an example workflow that builds & pushes a Docker image to GCR on every commit to master: # .github/workflows/docker-gcp.yml name: Docker-GCP on: push: branches: - master jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Setup gcloud uses: GoogleCloudPlatform/github-actions/setup-gcloud@master with: version: '290.0.1' service_account_key: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }} project_id: ${{ secrets.GCP_PROJECT_ID }} - name: Configure docker for GCP run: gcloud auth configure-docker - name: Build docker image run: docker build -t gcr.io/${{ secrets.GCP_PROJECT_ID }}/<YOUR_IMAGE_NAME>:latest .
🌐
GitHub
github.com › hpdobrica › push-to-gcr-github-action
GitHub - hpdobrica/push-to-gcr-github-action: An action that build docker image and push to Google Cloud Registry.
name: Push to GCR Github Action on: push: tags: - '*' jobs: build-and-push-to-gcr: runs-on: ubuntu-latest steps: - name: Get the version id: get_tag_name run: echo ::set-output name=GIT_TAG_NAME::${GITHUB_REF/refs\/tags\//} - uses: RafikFarhad/push-to-gcr-github-action@v1 with: gcloud_service_key: ${{ secrets.GCLOUD_SERVICE_KEY }} registry: gcr.io project_name: my-awesome-project image_name: server-end image_tag: ${{ steps.get_tag_name.outputs.GIT_TAG_NAME}} dockerfile: ./build/Dockerfile
Author   hpdobrica
🌐
Stack Overflow
stackoverflow.com › questions › 75219715 › docker-push-in-github-actions-to-gcr-creates-multiple-images
containers - Docker push in (GitHub actions) to GCR creates multiple images - Stack Overflow
- name: build and push to local registry uses: docker/[email protected] with: context: ${{ inputs.context }} file: ${{ inputs.context }}/${{ inputs.dockerfile }} no-cache: ${{ inputs.no_cache }} build-args: ${{ inputs.build_args }} push: true tags: ${{ env.LOCAL_IMAGE }} outputs: type=image,oci-mediatypes=false · I then use buildx to copy the image to a GCR registry
🌐
GitHub
github.com › marketplace › actions › push-docker-image-to-gcr
Push Docker Image to GCR · Actions · GitHub Marketplace · GitHub
Path to the context directory (containing the Dockerfile). ... Name of dockerfile. ... Google Cloud Project ID. Google Cloud Service Key (JSON). uses: Industrial/push-docker-gcr with: docker_image_name: api docker_image_tag: latest docker_context: ./services/api gcr_host: gcr.io gcr_project_id: ${{ secrets.GCLOUD_PROJECT_ID }} gcr_service_key: ${{ secrets.GCLOUD_SERVICE_KEY }}
🌐
GitHub
github.com › worklifebeyond › push-to-gcr
GitHub - worklifebeyond/push-to-gcr: Github workflow action to push a docker image to Google Cloud Registry
Add service-account.json to Github secret as GCLOUD_CREDENTIALS ... on: push jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@master - name: Build the Docker image run: | echo $GCLOUD_CREDENTIALS > keyfile.json cat keyfile.json | docker login -u _json_key --password-stdin https://gcr.io docker build .
Author   worklifebeyond