Skip to content

Migrate docker image build jobs to BuildKit

Oscar Tovar requested to merge improve-image-build-speed into master

What does this MR do?

This MR speeds up the tmp image build process by utilizing the BuildKit engine. It allows for the following:

  • Uses the --cache-to and --cache-from flags to store build cache in a registry. The image build cache registry by default will append /cache to the image name.
  • To enable the caching options, set the CACHE_IMAGE_BUILDS variable to true or 1. By default this option is set to false.
  • Allows for new Dockerfile features to be used like heredocs and RUN --mount.

I tested this by building the gemnasium-maven analyzer with and without the new build process. The build process usually took around 30m, and dropped to 1m after adding the new BuildKit powered job. This is a massive savings in computing resources, operating expenses, and further maximizes our dev velocity.

More information on how the BuildKit daemon works can be found on the project page.

What are the relevant issue numbers?

Relates to gitlab-org/gitlab#268160

Relates to gitlab-org/gitlab#369856

Does this MR meet the acceptance criteria?

Edited by Oscar Tovar

Merge request reports