Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support reproducible builds (except packages) #38

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AkihiroSuda
Copy link

@AkihiroSuda AkihiroSuda commented May 1, 2024

See:

  • Reproducible builds docker-library/official-images#16044

  • SOURCE_DATE_EPOCH is added. The value is consumed by the build scripts to make the binary reproducible.

  • 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:

Comment on lines 22 to 25
# SOURCE_DATE_EPOCH is consumed by build scripts
ARG SOURCE_DATE_EPOCH

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rest of this is unobjectionable, but I'm not in favor of ARG.

Suggested change
# SOURCE_DATE_EPOCH is consumed by build scripts
ARG SOURCE_DATE_EPOCH

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, could you explain the problem?
Isn't it quite common to specify the epoch for repro builds?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The SOURCE_DATE_EPOCH has been already used in the meta scripts, no?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tianon Please let me know how I can make progress on this PR (and other PRs tracked in docker-library/official-images#16044) 🙏

Do you prefer the SOURCE_DATE_EPOCH to be set to the timestamp of bash.tar.gz? ( As in golang)

I can update this PR like that if you like, but I think having the "global" ARG SOURCE_DATE_EPOCH here still makes sense, as SOURCE_DATE_EPOCH also applies to apk commands, etc.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tianon @tonistiigi

Updated the PR to take SOURCE_DATE_EPOCH from the source material (as in golang):

SOURCE_DATE_EPOCH="$(find /usr/src/bash -type f -exec stat -c '%Y' {} + | sort -nr | head -n1)"

Let me know if this solves your concern.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Completely removed ARG SOURCE_DATE_EPOCH

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this (and other PRs in docker-library/official-images#16044) mergeable? 🙏 @tianon @tonistiigi

@AkihiroSuda
Copy link
Author

ping 🙇‍♂️ @tianon

See docker-library/official-images issue 16044

- `SOURCE_DATE_EPOCH` is added.
  The value is consumed by the build scripts to make the binary reproducible.

- 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:
>   - modify the `FROM` instruction in Dockerfile manually
>   - or, use the `CONVERT` 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 in
>   moby/buildkit issue 4576
>
Signed-off-by: Akihiro Suda <[email protected]>

Signed-off-by: Akihiro Suda <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants