This document outlines the steps to deploy this service to Google Cloud Run using Docker Hub as the container registry.
gcloud CLI)Required for the gcloud run deploy command
gcloud auth login
gcloud config set project [YOUR_PROJECT_ID]
Required for the docker push command
docker login
Replace the values according to your project and Docker Hub account.
export DOCKER_USERNAME="[YOUR_DOCKER_HUB_USERNAME]"
export SERVICE_NAME="your-service" # Match your Docker Hub repo name
export TAG="latest" # or v1.0.1
export PROJECT_ID="[YOUR_PROJECT_ID]" # For gcloud
export REGION="asia-southeast2" # For gcloud
export IMAGE_NAME="${DOCKER_USERNAME}/${SERVICE_NAME}:${TAG}"
docker build -t $IMAGE_NAME .
docker push $IMAGE_NAME
Note that --image now points to the image on Docker Hub.
gcloud run deploy $SERVICE_NAME --image $IMAGE_NAME --platform managed --region $REGION --allow-unauthenticated --port 8080 --memory 2Gi --cpu 1 --min-instances 0 --max-instances 10 --concurrency 80 --timeout 300s --env-vars-file .env.yaml
.env.yaml FileMake sure your .env.yaml file follows the format below. DO NOT commit this file to Git if it contains secrets! Use .gitignore.
# Format: KEY: "VALUE" (values in quotation marks)
DATABASE_URL: "your-database-connection-string"
API_KEY: "your-secret-api-key"
52 commits
21 commits
Jupyter Notebook
92.6%
Python
7.3%
This document outlines the steps to deploy this service to Google Cloud Run using Docker Hub as the container registry.
gcloud CLI)Required for the gcloud run deploy command
gcloud auth login
gcloud config set project [YOUR_PROJECT_ID]
Required for the docker push command
docker login
Replace the values according to your project and Docker Hub account.
export DOCKER_USERNAME="[YOUR_DOCKER_HUB_USERNAME]"
export SERVICE_NAME="your-service" # Match your Docker Hub repo name
export TAG="latest" # or v1.0.1
export PROJECT_ID="[YOUR_PROJECT_ID]" # For gcloud
export REGION="asia-southeast2" # For gcloud
export IMAGE_NAME="${DOCKER_USERNAME}/${SERVICE_NAME}:${TAG}"
docker build -t $IMAGE_NAME .
docker push $IMAGE_NAME
Note that --image now points to the image on Docker Hub.
gcloud run deploy $SERVICE_NAME --image $IMAGE_NAME --platform managed --region $REGION --allow-unauthenticated --port 8080 --memory 2Gi --cpu 1 --min-instances 0 --max-instances 10 --concurrency 80 --timeout 300s --env-vars-file .env.yaml
.env.yaml FileMake sure your .env.yaml file follows the format below. DO NOT commit this file to Git if it contains secrets! Use .gitignore.
# Format: KEY: "VALUE" (values in quotation marks)
DATABASE_URL: "your-database-connection-string"
API_KEY: "your-secret-api-key"
52 commits
21 commits
Jupyter Notebook
92.6%
Python
7.3%