File tree Expand file tree Collapse file tree 4 files changed +19
-6
lines changed
Expand file tree Collapse file tree 4 files changed +19
-6
lines changed Original file line number Diff line number Diff line change 44FROM docker.io/ubuntu:24.04 AS builder
55
66ARG COMMIT_ID
7+ ARG COMMIT_TIMESTAMP
78ARG GO_VERSION
89ARG VERSION
910
1011ENV DEBIAN_FRONTEND=noninteractive
12+ ENV SOURCE_DATE_EPOCH=${COMMIT_TIMESTAMP}
1113RUN apt-get --assume-yes --no-install-recommends --update install \
1214 ca-certificates curl gcc git gnupg2 libc6-dev
1315
@@ -22,16 +24,18 @@ WORKDIR /opt/boulder
2224ENV GOBIN=/opt/boulder/bin/
2325RUN go install \
2426 -buildvcs=false \
25- -ldflags="-X \" github.com/letsencrypt/boulder/core.BuildID=${COMMIT_ID}\" -X \" github.com/letsencrypt/boulder/core.BuildTime=$(date -u)\" " \
27+ -trimpath \
28+ -ldflags="-X \" github.com/letsencrypt/boulder/core.BuildID=${COMMIT_ID}\" -X \" github.com/letsencrypt/boulder/core.BuildTime=$(date -u -d @${COMMIT_TIMESTAMP})\" " \
2629 -mod=vendor \
2730 ./...
2831
2932FROM docker.io/ubuntu:24.04
3033
34+ ARG COMMIT_DATE_ISO8601
3135ARG VERSION
3236
3337LABEL org.opencontainers.image.authors="Internet Security Research Group, https://letsencrypt.org/"
34- LABEL org.opencontainers.image.created="$(date -u +%Y-%m-%dT%H:%M:%SZ) "
38+ LABEL org.opencontainers.image.created="${COMMIT_DATE_ISO8601} "
3539LABEL org.opencontainers.image.description="Boulder is an ACME-compatible X.509 Certificate Authority"
3640LABEL org.opencontainers.image.documentation="https://github.com/letsencrypt/boulder"
3741LABEL org.opencontainers.image.licenses="MPL-2.0"
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ COPY go.mod go.sum vendor ./
99
1010COPY . .
1111
12- RUN go build -o /bin/ct-test-srv ./test/ct-test-srv/main.go
12+ RUN go build -trimpath - o /bin/ct-test-srv ./test/ct-test-srv/main.go
1313
1414FROM ubuntu:24.04
1515
Original file line number Diff line number Diff line change 2121
2222ARCH=" $( uname -m) "
2323COMMIT_ID=" $( git rev-parse --short=8 HEAD) "
24- VERSION=" ${GO_VERSION} .$( date +%s) "
24+ COMMIT_TIMESTAMP=" $( git show -s --format=%ct HEAD) "
25+ COMMIT_DATE_ISO8601=" $( TZ=UTC0 git show -s --format=%cd --date=format:%Y-%m-%dT%H:%M:%SZ HEAD) "
26+ VERSION=" ${GO_VERSION} .${COMMIT_TIMESTAMP} "
2527
2628docker buildx build \
2729 --file Containerfile \
2830 --build-arg " COMMIT_ID=${COMMIT_ID} " \
31+ --build-arg " COMMIT_TIMESTAMP=${COMMIT_TIMESTAMP} " \
32+ --build-arg " COMMIT_DATE_ISO8601=${COMMIT_DATE_ISO8601} " \
2933 --build-arg " GO_VERSION=${GO_VERSION} " \
3034 --build-arg " VERSION=${VERSION} " \
3135 --tag " boulder:${VERSION} " \
3236 --tag " boulder:${COMMIT_ID} " \
3337 --tag boulder \
3438 .
3539
36- docker run boulder tar -C /opt/boulder -cpz . > " ./boulder-${VERSION} -${COMMIT_ID} .${ARCH} .tar.gz" .
40+ docker run boulder tar -C /opt/boulder --mtime= " @ ${COMMIT_TIMESTAMP} " --owner=0 --group=0 --sort=name - cpz . > " ./boulder-${VERSION} -${COMMIT_ID} .${ARCH} .tar.gz"
3741# Produces e.g. boulder-1.25.0.1754519595-591c0545.x86_64.deb
3842docker run -v .:/boulderrepo \
39- -e " COMMIT_ID=$( git rev-parse --short=8 HEAD ) " \
43+ -e " COMMIT_ID=${COMMIT_ID} " \
4044 -e " VERSION=${VERSION} " \
45+ -e " SOURCE_DATE_EPOCH=${COMMIT_TIMESTAMP} " \
4146 boulder \
4247 /boulderrepo/tools/make-deb.sh
Original file line number Diff line number Diff line change @@ -29,4 +29,8 @@ Homepage: https://github.com/letsencrypt/boulder
2929Description: Boulder is an ACME-compatible X.509 Certificate Authority
3030EOF
3131
32+ # Normalize timestamps for reproducible builds (after all files created)
33+ find " ${BUILD} " ! -type l -exec touch -d " @${SOURCE_DATE_EPOCH} " {} \;
34+ find " ${BUILD} " -type l -exec touch -h -d " @${SOURCE_DATE_EPOCH} " {} \;
35+
3236dpkg-deb -Zgzip -b " ${BUILD} " " boulder-${VERSION} -${COMMIT_ID} .x86_64.deb"
You can’t perform that action at this time.
0 commit comments