I've only seen examples of using COPY to copy files between stages of a multi stage Dockerfile, but is there a way to simply copy an ENV variable? My use case is to start out with a git image to just to get the commit hash that will be part of the build. The image I'm later building with hasn't got git.
I realise I could just pipe out the git hash to a file and use COPY but I'm just wondering if there's a cleaner way?