A DevOps engineer needs to package a Python web application from local source code into a container image and deploy it to Google Cloud Run using the gcloud CLI. Place the following operational steps in the correct sequential order from first to last.
- 1Submit the local source code and Dockerfile to Cloud Build using gcloud builds submit to compile and push the container image to Artifact Registry.
- 2Deploy the container image to Cloud Run using gcloud run deploy, specifying the container image location, target region, and enabling unauthenticated access.
- 3Update the Cloud Run service configuration using gcloud run services update to set application environment variables.
- 4Execute an HTTP GET request using curl against the generated Cloud Run service URL to confirm successful deployment and response.
Answer
The correct sequence of steps is: 1) Build and push the container image to Artifact Registry using gcloud builds submit, 2) Deploy the container image to Cloud Run using gcloud run deploy, 3) Update service environment variables using gcloud run services update, and 4) Verify live service response by making an HTTP request to the assigned service URL.
Deploying a containerized web application to Cloud Run follows a logical lifecycle: first, source code must be built into a container image and pushed to Artifact Registry using Cloud Build. Second, the container image is deployed to Cloud Run using gcloud run deploy to provision the service revision. Third, service-level configurations such as environment variables are updated using gcloud run services update. Finally, sending an HTTP request to the live Cloud Run endpoint verifies that the deployment is functional and accepting requests.
Step-by-Step Solution
Key Concept
Deploying serverless containerized applications to Cloud Run using gcloud CLI build and deployment workflows