
Answer-first summary for fast verification
Answer: Use the pack build command with pack CLI., Include the --source flag with the gcloud run deploy CLI command.
To deploy an application on Cloud Run without a Dockerfile and ensure the image is stored in a central repository, the recommended approach involves using Google Cloud services like Cloud Build and Buildpacks. - **Option D** (`--source` flag with `gcloud run deploy`): This triggers Cloud Build automatically, which uses Buildpacks to build the container image, pushes it to Artifact Registry, and deploys to Cloud Run. This satisfies the requirement of using Google Cloud services and storing the image centrally. - **Option C** (`pack build` command): While the `pack` CLI is a local tool, it can be used within a Cloud Build job (a Google Cloud service) to build the image using Buildpacks. This ensures the image is built and pushed to the repository via Google Cloud services. Options A (incorrect, as Artifact Registry is for images, not source code), B (redundant if using `--source`, as Cloud Build is invoked automatically), and E (incorrect, as `--platform=kubernetes` is unrelated to Cloud Run) are excluded.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
How can you build and deploy a container for your new application on Cloud Run without a Dockerfile, while ensuring the image is pushed to your organization's centralized container repository using Google Cloud services? (Select two correct methods.)
A
Push your source code to Artifact Registry.
B
Submit a Cloud Build job to push the image.
C
Use the pack build command with pack CLI.
D
Include the --source flag with the gcloud run deploy CLI command.
E
Include the --platform=kubernetes flag with the gcloud run deploy CLI command.
No comments yet.