Google Professional Cloud Developer Question 342
Single answerGoogle Cloud PlatformYou want to deploy a Node.js application to Google Cloud without manually creating a Dockerfile or managing infrastructure. The application source code is stored in a GitHub repository. Which approach should you take to deploy the application efficiently?
- A
Use Google Cloud Build to create a custom Docker image and deploy it to a Google Kubernetes Engine (GKE) cluster.
- B
Use Cloud Run with the 'Deploy from source' option to build and deploy the application directly from the GitHub repository.
- C
Manually create a Compute Engine instance, clone the repository, and run the application using Node.js.
- D
Use App Engine Standard Environment, upload the source code, and specify the required runtime in the app.yaml file.
Show answer and explanation
Correct answer: B
Explanation
Cloud Run's 'Deploy from source' feature allows developers to deploy applications directly from source code stored in a GitHub repository. It abstracts the need to manually create Docker images or manage infrastructure, making it an efficient and developer-friendly choice for deploying applications quickly and reliably.
- A. Incorrect.
This option requires you to manually create a Docker image and manage the GKE cluster, which is not the most efficient way to deploy directly from source code.
- B. Correct.
This is the correct approach. Cloud Run can automatically build and deploy an application from a GitHub repository using the 'Deploy from source' feature, removing the need to manually manage Dockerfiles or infrastructure.
- C. Incorrect.
This approach involves manual infrastructure management and lacks the automation and scalability of Google Cloud's managed services, making it less efficient.
- D. Incorrect.
While App Engine Standard Environment supports deploying source code by specifying a runtime in the app.yaml file, it does not natively integrate with a GitHub repository for automated deployment. Additional steps like manual uploads would be required.