Skip to content

Instantly share code, notes, and snippets.

@nwaughachukwuma
Last active September 22, 2022 16:59
Show Gist options
  • Save nwaughachukwuma/325cfa132941d4b48990f56b2b146a7d to your computer and use it in GitHub Desktop.
Save nwaughachukwuma/325cfa132941d4b48990f56b2b146a7d to your computer and use it in GitHub Desktop.

Revisions

  1. nwaughachukwuma revised this gist Sep 22, 2022. 1 changed file with 0 additions and 2 deletions.
    2 changes: 0 additions & 2 deletions deploy-docker-image-to-cloud-run.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,3 @@
    ### How 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
  2. nwaughachukwuma revised this gist Sep 22, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion deploy-docker-image-to-cloud-run.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    Deploy a docker image to cloud run [for pros]
    ### How 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
  3. nwaughachukwuma created this gist Sep 22, 2022.
    22 changes: 22 additions & 0 deletions deploy-docker-image-to-cloud-run.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    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