The source project of this merge request has been removed.
Add support for docker caching options
Add support for docker buildx build --cache-from and --cache-to options. Together with GitLab CI/CD caching, it can considerably improve the performance of container image builds.
If the CACHE_FROM environment variable is set, the --cache-from will be added to docker buildx build command with the value of the CACHE_FROM variable. Similarly, if the CACHE_TO environment variable is set, the --cache-to will be added to docker buildx build command with the value of the CACHE_TO variable.
Example usage:
build_app:
cache:
key: my-app
paths:
- .cache/my-app/
extends:
- .build_docker
variables:
PUSH_IMAGE: "true"
REGISTRY_IMAGE_PATH : "registry.cern.ch/my-project/my-repo:${CI_COMMIT_SHA}"
CONTEXT_DIR: ${CI_PROJECT_DIR}
DOCKER_FILE_NAME: Dockerfile
CACHE_FROM: "type=local,src=${CI_PROJECT_DIR}/.cache/my-app"
CACHE_TO: "type=local,dest=${CI_PROJECT_DIR}/.cache/my-app"
Edited by Arkadiusz Brunon Podkowa