Open
Description
Is it possible to configure --no-cache
for only the new layers introduced by a specific target with bake?
FROM <xyz> as layer-2
RUN ...
FROM layer-2 as layer-3
RUN ...
group "default" {
targets = [
"layer-2",
"layer-3"
]
}
target "layer-2" {
tags = [ "layer-2" ]
target = "layer-2"
}
target "layer-3" {
tags = [ "layer-3" ]
target = "layer-3"
# cache-from = [ "type=parents" ]
# or
# cache-to = ["type=skip"]
}
IE, I want the RUN from layer-2 to be cached, and I want layer-3 to build off of the existing layer-2, but I don't want layer-3's RUN to ever be cached. I could achieve this by explicitly introducing cache-breaking logic as the first step in the layer-3 Dockerfile, but it would be able to nice to be able to express this workflow at the build-tooling level.
I imagine hypothetical configuration for this might work by blocking it on the way in cache-from = [ "type=parents" ]
, or not writing to the inline cache on the way out cache-to = ["type=skip"]
.