Skip to content

explooosion/react-gcp-deploy-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

React GCP Deploy Example

Build your app to docker image, publish and deploy on GCP Cloud Run with github actions.

Blog: GCP - 使用 Github Actions 部署 React 到 Cloud Run

Configuration

  1. Create GCP project

  2. Creating service account keys

  3. Download json key look like this:

{
  "type": "service_account",
  "project_id": "project-id",
  "private_key_id": "key-id",
  "private_key": "-----BEGIN PRIVATE KEY-----\nprivate-key\n-----END PRIVATE KEY-----\n",
  "client_email": "service-account-email",
  "client_id": "client-id",
  "auth_uri": "https://accounts.google.com/o/oauth2/auth",
  "token_uri": "https://accounts.google.com/o/oauth2/token",
  "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
  "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/service-account-email"
}
  1. Create Github Secrets

    • GCP_SA_EMAIL
    • GCP_SA_KEY (paste json file)
    • GCP_PROJECT_ID
  2. Add main.yml to your project

  3. Add Dockerfile to your project

  4. Push your project to Github repo

  5. Run Github Actions