{"id":25049443,"url":"https://github.com/harmoniousmoss/cloudrun-ci-cd","last_synced_at":"2025-06-16T08:35:26.662Z","repository":{"id":275706229,"uuid":"926930348","full_name":"harmoniousmoss/cloudrun-ci-cd","owner":"harmoniousmoss","description":"step-by-step guide to setting up a CI/CD pipeline for automated Docker deployment to Google Cloud Run","archived":false,"fork":false,"pushed_at":"2025-02-04T12:17:13.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-31T03:41:22.144Z","etag":null,"topics":["cloudrun","docker","google-cloud-platform"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/harmoniousmoss.png","metadata":{"files":{"readme":"README.MD","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-04T05:20:33.000Z","updated_at":"2025-02-04T12:17:17.000Z","dependencies_parsed_at":"2025-02-04T06:33:35.920Z","dependency_job_id":null,"html_url":"https://github.com/harmoniousmoss/cloudrun-ci-cd","commit_stats":null,"previous_names":["harmoniousmoss/cloudrun-ci-cd"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/harmoniousmoss/cloudrun-ci-cd","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harmoniousmoss%2Fcloudrun-ci-cd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harmoniousmoss%2Fcloudrun-ci-cd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harmoniousmoss%2Fcloudrun-ci-cd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harmoniousmoss%2Fcloudrun-ci-cd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/harmoniousmoss","download_url":"https://codeload.github.com/harmoniousmoss/cloudrun-ci-cd/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harmoniousmoss%2Fcloudrun-ci-cd/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260126714,"owners_count":22962675,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cloudrun","docker","google-cloud-platform"],"created_at":"2025-02-06T08:18:28.518Z","updated_at":"2025-06-16T08:35:26.589Z","avatar_url":"https://github.com/harmoniousmoss.png","language":null,"readme":"# Deploying Docker Applications to Cloud Run with CI/CD\n\n## Overview\n\nThis tutorial provides a step-by-step guide to setting up a CI/CD pipeline for automated Docker deployment to Google Cloud Run. By leveraging Google Cloud Build, we will automate the process of building, testing, and deploying containerized applications to Cloud Run. This ensures a seamless and efficient deployment workflow.\n\n## Prerequisites\n\nBefore starting, ensure you have the following:\n\n- A **Google Cloud Platform (GCP)** account with billing enabled\n- The **gcloud CLI** installed and configured\n- A **Dockerfile** in your project repository\n\n## What You'll Learn\n\n- How to containerize an application with Docker\n- How to push Docker images to Google Container Registry (GCR) or Artifact Registry\n- How to Cloud Build for continuous deployment\n- How to deploy and manage applications on Cloud Run\n\nLet's get started! 🚀\n\n## Step 1: Create a New Repository in Google Cloud Artifact Registry\n\nTo store your Docker images in Google Cloud Artifact Registry, follow these steps:\n\n1. Navigate to the **Google Cloud Console** and go to **Artifact Registry**.\n2. Click **Create Repository**.\n3. In the **Create Repository** section:\n   - Choose **Docker** as the format.\n   - Select **Standard** as the mode.\n   - Set the **Location Type** based on your needs (either **Region** or **Multi-region**).\n4. To enable vulnerability scanning for your images, enable **Artifact Analysis**.\n5. Click the **Create** button to finalize the repository setup.\n\nWith your repository set up, you are now ready to push your Docker images to Google Cloud Artifact Registry!\n\nStep 2: Create a Cloud Build Trigger\n------------------------------------\n\n1.  Navigate to **Cloud Build** in the Google Cloud Console.\n    \n2.  Select the **Triggers** tab and click **Add Trigger**.\n    \n3.  In the **Create Trigger** section:\n    \n    *   Provide a name for your trigger.\n        \n    *   Leave all other settings as default.\n        \n    *   Under **Repository**, select your version control system (e.g., GitHub).\n        \n4.  Ensure your code is pushed to the repository before proceeding.\n    \n5.  Connect your version control account to Cloud Build.\n    \n6.  Select the branch you plan to deploy.\n    \n7.  Click **Create** to finalize the setup.\n\n\nStep 3: Place and modify this cloudbuild.yaml file in your repository\n------------------------------------\n\n```\nsteps:\n  # Build the Docker image using Buildx for the amd64 architecture\n  - name: 'gcr.io/cloud-builders/docker'\n    entrypoint: 'bash'\n    args:\n      - '-c'\n      - |\n        docker buildx create --use\n        docker buildx build --platform linux/amd64 --load -t \"Your artifact registry URL:$SHORT_SHA\" .\n\n  # Push the image to Google Artifact Registry\n  - name: 'gcr.io/cloud-builders/docker'\n    args: ['push', 'Your artifact registry URL:$SHORT_SHA']\n\n  # Deploy the image to Cloud Run\n  - name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'\n    entrypoint: 'gcloud'\n    args:\n      - 'run'\n      - 'deploy'\n      - 'macromonitor'  # Replace with your Cloud Run service name that you want to deploy\n      - '--image=\"Your artifact registry URL:$SHORT_SHA\"'\n      - '--region=\"your region\"'  # Replace with your region\n      - '--platform=managed'\n      - '--allow-unauthenticated'\n\nsubstitutions:\n  _SHORT_SHA: 'latest'\n\nimages:\n  - \"Your artifact registry URL:$SHORT_SHA\"\n```\n\nStep 4: Try to modify your local repository then pushed it to your GitHub repository to trigger the Cloud Build\n------------------------------------\n1. You can visit your cloud build section to see the build process and the deployment process.\n2. Upon successful deployment, you can access your application on Cloud Run using the provided URL. \n\nCongratulations! You have successfully set up a CI/CD pipeline for deploying Docker applications to Google Cloud Run.\n\n\n## Authors\n\n- [@harmoniousmoss](https://www.github.com/harmoniousmoss)\n\nIf you have any questions or need further assistance, feel free to reach out at syaefulbahri[at]protonmail.com.\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharmoniousmoss%2Fcloudrun-ci-cd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fharmoniousmoss%2Fcloudrun-ci-cd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharmoniousmoss%2Fcloudrun-ci-cd/lists"}