Cloud Build builds a Python app image using FROM python:3.7-alpine and gunicorn. Builds are slow. Which two actions reduce build time?
Choose an answer
Tap an option to check your answer.
Correct answer: Select a virtual machine (VM) size with higher CPU for Cloud Build runs., Cache the Docker image for subsequent builds using the -- cache-from argument in your build config file..
Why this is the answer
Increasing the VM size for Cloud Build provides more CPU and memory resources, directly accelerating build processes, especially for compute-intensive tasks like compiling or dependency resolution. Caching Docker layers with --cache-from reuses previously built layers, avoiding redundant downloads and builds of unchanged base images or dependencies, significantly reducing build times for subsequent builds. Deploying Container Registry on a Compute Engine VM is unnecessary; Google Container Registry (GCR) is a managed service. Changing the base image to ubuntu:latest and installing Python would likely increase build time due to a larger base image and additional installation steps. Storing source code on Cloud Storage and using gsutil is not a typical or efficient method for Cloud Build, which integrates directly with source repositories like Cloud Source Repositories or GitHub.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed