Support reproducible builds (except packages) #250
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.
Background:
Alternative to:
SOURCE_DATE_EPOCH
is added. The value is consumed by the build scripts to make thehttpd
binary reproducible.GNU implementation of
wget
is executed with--no-hsts
to disable creating/root/.wget-hsts
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.0-beta1 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.0-beta1/docs/build-repro.mdTo reproduce Debian packages, reproducers may:
RUN
instructions in the Dockerfile to rewrite/etc/apt/sources.list
to use http://snapshot.debian.org, and restore/etc/apt/sources.list
at the end of the instruction (See the rejected PR Support reproducible builds for Debian #248)RUN
instructions (use cases: reproducible builds, cross-compilation, malware detection, ...) moby/buildkit#4576