Migrate docker image build jobs to BuildKit
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 totrue
or1
. By default this option is set tofalse
. - 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?
-
Tests added for this feature/bug - See this job and its history for a comparison in job duration.
Edited by Oscar Tovar