Support reproducible builds (except packages) #455
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See:
SOURCE_DATE_EPOCH
is added. The value is consumed by the build scripts to make the binary reproducible.For Debian,
/var/log/*
is removed as they contain timestampsFor Debian,
/var/cache/ldconfig/aux-cache
is removed as they contain inode numbers, etc.For Alpine, virtual package versions are pinned to "0" to eliminate the timestamp-based version numbers that appear in
/etc/apk/world
and/lib/apk/db/installed
Note
The following topics are NOT covered by this commit:
To reproduce file timestamps in layers, BuildKit has to be executed with
--output type=<TYPE>,rewrite-timestamp=true
.Needs BuildKit v0.13 or later.
To reproduce the base image by the hash, reproducers may:
FROM
instruction in Dockerfile manuallyCONVERT
action of source policies to replace the base image.https://github.com/moby/buildkit/blob/v0.13.2/docs/build-repro.md
To reproduce packages, see the
RUN
instruction hook proposed inProposal: hooks for
RUN
instructions (use cases: reproducible builds, cross-compilation, malware detection, ...) moby/buildkit#4576Also, Alpine-based images still have the following diff: