buildkit
buildkit copied to clipboard
Support extracting `ADD --checksum=.. https://.. ..`
Today, ADD
only extracts archives sources from the local
context. fetch
ed URLs aren't decompressed.
Since then, --checksum=
was introduced and I believe this exact feature should now allow to extract (checksum'd) URLs!
I propose introducing a new BuildKit built-in build arg (e.g. ARG BUILDKIT_ADD_URLS_EXTRACTED=1
) that makes it so that ADD
extracts the downloaded & digested content.
- Using
--checksum=..
without thisARG
, current behavior is preserved: failure. -
ARG
can be set stage-level as well as dockerfile-level but maybe shouldn't be set on daemon-level without bells on whistles.
Example (non-working today):
docker build --no-cache --output=type=tar,dest=./myar.tar - <<EOF
# syntax=docker.io/docker/dockerfile:sometag
FROM scratch
ARG BUILDKIT_ADD_URLS_EXTRACTED=1
ADD --chmod=0664 --checksum=sha256:e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae \
https://static.crates.io/crates/proc-macro2/proc-macro2-1.0.78.crate /
EOF
And myar.tar
then contains /Cargo.toml
, /src/lib.rs
, ...
Finally, I'd like to then also discuss the addition of a subflag: to enable tar
's --strip-components=1
.