10-minute builds: Serverless Docker with CI/CD pipeline

Prerequisites

  • A GitHub account
  • A Google Cloud account
  • Knowledge on Docker

Step 1: Create your GitHub repository

Step 2: Build your container

  • Pick a programming language/runtime with a fast cold start time
  • You are not limited to one endpoint within your containers
  • Your entire repository is cloud agnostic

Step 3: Create your Google Cloud Project

  1. You can navigate to this URL to create a Google Cloud Project.
  2. Give your project a name and leave the rest of the settings as default.
  3. After the project is created, click ‘VIEW’ on the notification panel.
  4. Next, you must enable billing.

Step 4: Deploy!

  1. Click ‘+ Create Service’ in the top toolbar.
  2. Select Cloud Run (fully managed) as the deployment platform and choose a zone.
  3. Give your service a name
  4. Allow unauthenticated invocations, this is so that the public can access your instance.
  5. Click ‘Next’
  6. Select the “Continuously deploy new revisions from a source repository” and set it up with Cloud Build. This will trigger you to login to GitHub and select a repository. You might need to enable some APIs.
  7. Click next, in this dialog you can configure where your Dockerfile is located. The default should be fine if the Dockerfile is in the root of your master branch.
  8. You can further edit settings like adding environmental variables, cloud-specific settings, machine specs, etc.
  9. Then finally, create!
Deployed Cloud Run service

Conclusion

  • Manage traffic between revisions
  • Deploy Cloud Run to Kubernetes instead
  • Edit CI/CD settings, or better yet save your CI/CD as YAML code.

Connect with me

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ryan Susana

Ryan Susana

I like code, chess, reggae & hip-hop. 🇸🇽