Ensure reproducible builds - support for SOURCE_DATE_EPOCH with dockerized builds

- Pass in SOURCE_DATE_EPOCH when we run the docker container
- Looks like cleaning up symbol table also helps
- Also trimming the path

Tips from
- https://blog.filippo.io/reproducing-go-binaries-byte-by-byte/
- https://blog.filippo.io/shrink-your-go-binaries-with-this-one-weird-trick/

Change-Id: Iedba85d9c1a36790fb8814795f7c27c1371cff1b
This commit is contained in:
Davanum Srinivas
2018-09-24 12:21:18 -04:00
parent 8c1fe2e1df
commit d9cfd77149
2 changed files with 9 additions and 3 deletions

View File

@@ -600,6 +600,7 @@ function kube::build::run_build_command_ex() {
--env "GOFLAGS=${GOFLAGS:-}"
--env "GOLDFLAGS=${GOLDFLAGS:-}"
--env "GOGCFLAGS=${GOGCFLAGS:-}"
--env "SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH:-}"
)
if [[ -n "${DOCKER_CGROUP_PARENT:-}" ]]; then