This basically treats from("scratch") as any other image in order to simplify buildkit-frontend logic. buildkit.rs will "resolve" those by building the following Dockerfile:
FROM scratch
and the frontend would use Source::image(id), where id is the empty image just built.
The alternative is to use buildkit_llb::ops::exec::Mount::Scratch whenever the parent is from("scratch"), but with this approach, due to the limit of the buildkit_llb rust library, it is not possible to output from("scratch") as the final image.
Note that, also due to poor library design, resolve_image_config will fail when the image is empty. This is worked-around by treating FromScratch specially.
This basically treats
from("scratch")
as any other image in order to simplify buildkit-frontend logic. buildkit.rs will "resolve" those by building the following Dockerfile:and the frontend would use
Source::image(id)
, whereid
is the empty image just built.The alternative is to use
buildkit_llb::ops::exec::Mount::Scratch
whenever the parent isfrom("scratch")
, but with this approach, due to the limit of the buildkit_llb rust library, it is not possible to outputfrom("scratch")
as the final image.Note that, also due to poor library design,
resolve_image_config
will fail when the image is empty. This is worked-around by treating FromScratch specially.