Skip to content

Commit 6579892

Browse files
authored
Merge pull request moby#4096 from AkihiroSuda/cherrypick-3980-0.12
[0.12 backport] docs/build-repro.md: fix description about squashing
2 parents f517cc2 + 87d75a1 commit 6579892

File tree

2 files changed

+6
-14
lines changed

2 files changed

+6
-14
lines changed

docs/build-repro.md

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,20 +71,12 @@ Workaround:
7171
# Workaround for https://github.com/moby/buildkit/issues/3180
7272
ARG SOURCE_DATE_EPOCH
7373
RUN find $( ls / | grep -E -v "^(dev|mnt|proc|sys)$" ) -newermt "@${SOURCE_DATE_EPOCH}" -writable -xdev | xargs touch --date="@${SOURCE_DATE_EPOCH}" --no-dereference
74-
```
75-
76-
The `touch` command above is [not effective](https://github.com/moby/buildkit/issues/3309) for mount point directories.
77-
A workaround is to create mount point directories below `/dev` (tmpfs) so that the mount points will not be included in the image layer.
78-
79-
### Timestamps of whiteouts
80-
Currently, the `SOURCE_DATE_EPOCH` value is not used for the timestamps of "whiteouts" that are created on removing files.
8174

82-
Workaround:
83-
```dockerfile
84-
# Squash the entire stage for resetting the whiteout timestamps.
85-
# Workaround for https://github.com/moby/buildkit/issues/3168
75+
# Squashing is needed so that only files with the defined timestamp from the last layer are added to the image.
76+
# This squashing also addresses non-reproducibility of whiteout timestamps (https://github.com/moby/buildkit/issues/3168) on BuildKit prior to v0.12.
8677
FROM scratch
8778
COPY --from=0 / /
8879
```
8980

90-
The timestamps of the regular files in the original stage are maintained in the squashed stage, so you do not need to touch the files after this `COPY` instruction.
81+
The `touch` command above is [not effective](https://github.com/moby/buildkit/issues/3309) for mount point directories.
82+
A workaround is to create mount point directories below `/dev` (tmpfs) so that the mount points will not be included in the image layer.

frontend/dockerfile/dockerfile_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6688,8 +6688,8 @@ RUN rm -f /foo-2030.1
66886688
ARG SOURCE_DATE_EPOCH
66896689
RUN find $( ls / | grep -E -v "^(dev|mnt|proc|sys)$" ) -newermt "@${SOURCE_DATE_EPOCH}" -writable -xdev | xargs touch --date="@${SOURCE_DATE_EPOCH}" --no-dereference
66906690
6691-
# Squash the entire stage for resetting the whiteout timestamps.
6692-
# Workaround for https://github.com/moby/buildkit/issues/3168
6691+
# Squashing is needed to apply the touched timestamps across multiple "RUN" instructions.
6692+
# This squashing also addresses non-reproducibility of whiteout timestamps (https://github.com/moby/buildkit/issues/3168).
66936693
FROM scratch
66946694
COPY --from=0 / /
66956695
`)

0 commit comments

Comments
 (0)