Skip to content

Instantly share code, notes, and snippets.

@nwaughachukwuma
Last active September 22, 2022 16:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nwaughachukwuma/325cfa132941d4b48990f56b2b146a7d to your computer and use it in GitHub Desktop.
Save nwaughachukwuma/325cfa132941d4b48990f56b2b146a7d to your computer and use it in GitHub Desktop.
Seven easy steps to deploy a docker image to cloud run [for pros]
  1. Build the image from a Dockerfile
    1. docker build ./ --tag {name}:latest. Advisable to use your service name here
  2. Test if the application is running
    1. docker run -p 8080:8080 -it name
    2. docker run -p 8080:8080 -e ENV=VALUE -it name
      1. e.g. docker run -p 8080:8080 -e PORT=8080 -it name
  3. Configure docker on GCloud CLI
    1. gcloud auth configure-docker gcr.io
    2. gcloud auth configure-docker {region}.gcr.io
  4. Enable cloud-run if it isn’t enabled, using cloud console or GCloud CLI
  5. Map the tag to your service on Cloud Run
    1. docker tag name gcr.io/{PROJECT_ID}/{service_name}
  6. Push the image to GCloud container registry
    1. `docker push gcr.io/{PROJECT_ID}/{service_name}
  7. Provision the image on cloud run
    1. Go to your service on cloud run
    2. Choose EDIT and DEPLOY
    3. Select your image from container registry
    4. Select custom options as it suits your project
    5. Deploy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment