Professional Cloud Developer · Free Practice Question Medium
Question 10
You are setting up a continuous integration pipeline via Cloud Build to automate the deployment of fresh container images to Google Kubernetes Engine (GKE). The pipeline compiles the application from its source code, executes unit and integration tests as separate procedures, and pushes the container to Container Registry. The application is hosted on a Python web server.
The Dockerfile is shown below:
``
FROM python:3.7-alpine -
COPY . /app -
WORKDIR /app -
RUN pip install -r requirements.txt
CMD [ "gunicorn", "-w 4", "main:app" ]
``
You have observed that Cloud Build runs are taking longer than expected to complete and aim to reduce the build time. (Select two.)
What actions do you need to take?
- A Save the application source code on Cloud Storage and configure the pipeline to download the source code using gsutil.
- B Utilize a package manager to install Python 3.7 and change the base image in the Dockerfile to ubuntu:latest.
- C Deploy a Container Registry on a Compute Engine VM in a VPC and use it for storing final images.
- D Cache the Docker image for future builds by using the --cache-from argument in the build config file.
- E Select a VM size with higher CPU for Cloud Build runs.
Reveal correct answers
Correct answers: D, E
Explanation
To decrease the build time for the continuous integration pipeline using Cloud Build to automate the deployment of new container images to GKE, two possible solutions are suggested. The first option is to select a virtual machine (VM) size with higher CPU for Cloud Build runs, which can significantly reduce the build time. Cloud Build offers a variety of machine types to choose from, and selecting a machine type with a higher CPU can help speed up the build process. The second option is to cache the Docker image for subsequent builds using the --cache-from argument in the build config file. This option can help speed up the build process by reusing layers from a previously built Docker image, which can result in faster builds and reduced costs.Discussion
Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.
