-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Description
Currently, --cache-from is interpreted as simple image reference, as this is only an exact format for Docker CLI without Buildx.
Now Buildx is almost standard builder for Docker. (installed by default with Docker Desktop) With Buildx, docker build is overwritten as an alias for docker buildx build. It supports rich option for caching. --cache-from accepts new format like type=registry,ref=user/app or type=local,src=path/to/code as well as previous one. Previous format option is regarded as registry cache. Moreover, Buildx supports --cache-to option for storing build caches.
Skaffold should acceepts these options.
Expected Behaivior
Accept skaffold.yaml below:
kind: Config
build:
artifacts:
- image: repository/name
context: .
docker:
dockerfile: Dockerfile
cacheFrom:
- type=registry,ref=repository/name:latest
- type=registry,ref=repository/name:latest-cache
cacheTo:
- type=registry,mode=max,ref=repository/name:latest-cache
tagPolicy:
sha256: {}
deploy:
docker:
images: [repository/name]If the type is registry, pull the cache image to local before build as previous behaivior with simple image reference format.
Discussion
There is an option to specify the cache option in more structual format like below:
cacheFrom:
- "golang:1.25"
- type: registry
ref: repository/name:latest
- type: local
src: path/to/cacheI think this is too complicated to validate format since acceptable keys differ by type.