Google’s Cloud Run product allows for scalable containerized applications in a fully managed serverless environment.

Since Cloud Run is serverless it allows your services to scale down to zero and incur no charges or scale to infinity when your app blows up! 🤯

This makes for a great way to quickly deploy and host any number of web applications for very cheap on new startups and highly scalable for a growing product.

In this tutorial, we’re going to use  create-react-app to quickly spin up a new React project. Then create a Docker image, with the help of Nginx, to create a containerized version of our React app. Next, we’ll push our Docker image to Google Container Registry and manually deploy our image to a Cloud Run service. Finally, we’ll set up a GitHub Action workflow to build, dockerize, and deploy our app whenever we push to master.

  • create-react-app
  • Docker
  • Google Container Registry (GCR)
  • Google Cloud Run (other GCR 👀)
  • GitHub Action (GHA)

create-react-app

Assuming you already have Node.js installed, run the following command to create a brand new create-react-app.

npx create-react-app my-app

This tool simply allows us to get up and running with a working React app, if you know of a better process or tool to create a start React app, feel free to use that instead!

Note: I personally recommend using TypeScript, it makes the development experience a lot friendlier, this can be done with create-react-app templates:

npx create-react-app my-app --template typescript

At this point, feel free to develop your React app to your heart’s content, but for the remainder of the tutorial, the base CRA is enough.

#docker #google-cloud-platform #google-cloud-run #react

Deploying a React App to Google Cloud Run with GitHub Actions
24.30 GEEK