Has anyone explored reproducible docker image buil...
# general
f
Has anyone explored reproducible docker image builds while using pants? I tracked down a bunch of remote-cache misses in our CI system stemming from the docker_image target producing a new digest every time https://github.com/pantsbuild/pants/issues/20699
b
Ah, nice one! I've been meaning to get my work docker images to be reproducible but haven't quite got there yet. I imagine one could use https://www.pantsbuild.org/2.20/docs/using-pants/key-concepts/options#pantsbootstrap-file to set
export CURRENT_COMMIT_DATE=$(...)
or
SOURCE_DATE_EPOCH
within Pants environment and then pass that down into the docker invocations via https://www.pantsbuild.org/2.20/reference/subsystems/docker#env_vars
I assume you're aware that using the commit date may make for images that change "unnecessarily" vs. using a fixed timestamp (e.g. build image X from commit A, do a commit B that doesn't touch any inputs to X, rebuild X => will change just because of the dates)
f
Yeah I'd prefer something more complex that used the dates of the transitive source files