All Projects → RafikFarhad → push-to-gcr-github-action

RafikFarhad / push-to-gcr-github-action

Licence: MIT license
An action that build docker image and push to Google Cloud Registry and Google Artifact Registry.

Programming Languages

shell
77523 projects
Dockerfile
14818 projects
c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to push-to-gcr-github-action

Komiser
☁️ Cloud Environment Inspector 👮🔒 💰
Stars: ✭ 2,684 (+6141.86%)
Mutual labels:  gcp
CloudFrontier
Monitor the internet attack surface of various public cloud environments. Currently supports AWS, GCP, Azure, DigitalOcean and Oracle Cloud.
Stars: ✭ 102 (+137.21%)
Mutual labels:  gcp
auth
A GitHub Action for authenticating to Google Cloud.
Stars: ✭ 567 (+1218.6%)
Mutual labels:  gcp
Engine
Deploy your apps on any Cloud provider in just a few seconds
Stars: ✭ 1,132 (+2532.56%)
Mutual labels:  gcp
cb-spider
CB-Spider provides a unified view and single interface for multi-cloud management.
Stars: ✭ 26 (-39.53%)
Mutual labels:  gcp
hipaa-cloud-resources
HIPAA Cloud Resources -- a structured guide on usage of cloud services in the healthcare industry
Stars: ✭ 23 (-46.51%)
Mutual labels:  gcp
Cloud
The TensorFlow Cloud repository provides APIs that will allow to easily go from debugging and training your Keras and TensorFlow code in a local environment to distributed training in the cloud.
Stars: ✭ 229 (+432.56%)
Mutual labels:  gcp
DeployMachineLearningModels
This Repo Contains Deployment of Machine Learning Models on various cloud services like Azure, Heroku, AWS,GCP etc
Stars: ✭ 14 (-67.44%)
Mutual labels:  gcp
quarkus-google-cloud-services
Google Cloud Services Quarkus Extensions
Stars: ✭ 42 (-2.33%)
Mutual labels:  gcp
gcpnatha
How to set up multiple NAT gateways with Equal Cost Multi-Path (ECMP) routing and autohealing enabled for a more resilient and high-bandwidth deployment using Deployment Manager.
Stars: ✭ 16 (-62.79%)
Mutual labels:  gcp
Infracost
Cloud cost estimates for Terraform in pull requests💰📉 Love your cloud bill!
Stars: ✭ 4,505 (+10376.74%)
Mutual labels:  gcp
GCP
All files containing commands which can be used to complete GCP quests and challenge labs
Stars: ✭ 46 (+6.98%)
Mutual labels:  gcp
sops-operator
A Kubernetes operator for Mozilla SOPS
Stars: ✭ 23 (-46.51%)
Mutual labels:  gcp
Rdbox
RDBOX is an advanced IT platform for robotics and IoT developers that highly integrates cloud-native and edge computing technologies.
Stars: ✭ 246 (+472.09%)
Mutual labels:  gcp
deploy-appengine
A GitHub Action that deploys source code to Google App Engine.
Stars: ✭ 184 (+327.91%)
Mutual labels:  gcp
Devops Bash Tools
550+ DevOps Bash Scripts - AWS, GCP, Kubernetes, Kafka, Docker, APIs, Hadoop, SQL, PostgreSQL, MySQL, Hive, Impala, Travis CI, Jenkins, Concourse, GitHub, GitLab, BitBucket, Azure DevOps, TeamCity, Spotify, MP3, LDAP, Code/Build Linting, pkg mgmt for Linux, Mac, Python, Perl, Ruby, NodeJS, Golang, Advanced dotfiles: .bashrc, .vimrc, .gitconfig, .screenrc, .tmux.conf, .psqlrc ...
Stars: ✭ 226 (+425.58%)
Mutual labels:  gcp
kafka-connect-fs
Kafka Connect FileSystem Connector
Stars: ✭ 107 (+148.84%)
Mutual labels:  gcp
gcp-dl
Deep Learning on GCP
Stars: ✭ 27 (-37.21%)
Mutual labels:  gcp
gcp auth
Minimal authentication library for Google Cloud Platform (GCP)
Stars: ✭ 42 (-2.33%)
Mutual labels:  gcp
DevSecOps
Ultimate DevSecOps library
Stars: ✭ 4,450 (+10248.84%)
Mutual labels:  gcp

Push to GCR GitHub Action

An action that builds docker image and pushes to Google Cloud Registry and Google Artifact Registry.

This action can be used to perform on every git push or every tag creation.

Inputs

gcloud_service_key

The service account key of google cloud. The JSON file can be encoded in base64 or in plain text.

Prior to version 4.1 - This field is required.

From version 5 - This field is optional when you are using workload identity with google-github-actions/auth

registry

The registry where the image should be pushed. Default gcr.io.

project_id

The project id. This field is required.

image_name

The image name. This field is required.

image_tag

The tag for the image. To create multiple tags of the same image, provide a comma (,) separated tag name (e.g. v2.1,v2,latest).

Default: latest.

To use the pushed Tag Name as image tag, see the example.

dockerfile

The image building Dockerfile. If the context is not the root of the repository, Dockerfile from the context folder will be used.

Default: ./Dockerfile.

context

The docker build context. Default: .

target

If you use a multi-stage build and want to stop building at a certain image, you can use this field. The default value is empty.

build_args

Pass a list of env vars as build-args for docker-build, separated by commas. ie: HOST=db.default.svc.cluster.local:5432,USERNAME=db_user

push_only

If you want to skip the build step and just push the image built by any previous step, use this option. The default for this is false.

Permissions

The service key you provided must have the Storage Admin permission to push the image to GCR. It is possible to use a lower access level Storage Object Admin, but it will work only if the registry is already created. You must also add the Storage Legacy Bucket Reader permission to the artifacts.<project id>.appspot.com bucket for the given service account.

Reference 1

Reference 2

To create service key/account visit here

Workload Identity Federation

If you want to use Workload Identity Federation, follow the steps from here to set up Workload Identity Federation

Example usage

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@v3
      - name: Authenticate to Google Cloud
        id: auth
        uses: google-github-actions/auth@v0
        with:
          workload_identity_provider: projects/123123123/locations/global/workloadIdentityPools/the-workload-pool/providers/the-provider
          service_account: only-storage-object-adm@<PROJECT_ID>.iam.gserviceaccount.com
      - uses: RafikFarhad/push-to-gcr-github-action@v5-beta
        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

A complete workflow example with all type of authentication flavour

More Example

Contribution

  • Fork
  • Implement your awesome idea or fix a bug
  • Create PR 🎉

NB: The included workflow which tests the action's basic functionalities needs a GitHub secret named JSON_GCLOUD_SERVICE_ACCOUNT_JSON. Currently, the workflow is not testable for forked repositories but I have an action item to enable this.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].