This sample shows how to deploy a Hello World application to Cloud Run.
-
Clone this repository:
git clone https://github.com/GoogleCloudPlatform/ruby-docs-samples.git
-
Create an Artifact Registry:
gcloud artifacts repositories create containers --repository-format docker --location ${GOOGLE_CLOUD_REGION}
docker build --tag helloworld:ruby .
docker run --rm -p 9090:8080 -e PORT=8080 helloworld:ruby
# Set an environment variable with your GCP Project ID
export GOOGLE_CLOUD_PROJECT=<PROJECT_ID>
# Install dependencies
bundle install
# Run tests
bundle exec rspec
# Set an environment variable with your GCP Project ID
export GOOGLE_CLOUD_PROJECT=<PROJECT_ID>
# Set an environment variable with your Google Cloud region
export GOOGLE_CLOUD_REGION=<REGION>
# Submit a build using Google Cloud Build
gcloud builds submit --tag ${GOOGLE_CLOUD_REGION}-docker.pkg.dev/${GOOGLE_CLOUD_PROJECT}/containers/helloworld
# Deploy to Cloud Run
gcloud run deploy helloworld --image ${GOOGLE_CLOUD_REGION}-docker.pkg.dev/${GOOGLE_CLOUD_PROJECT}/containers/helloworld
Visit your deployed container by opening the service URL in a web browser.