Using SSH private keys securely when building Docker images

It is quite common situation when you are building Docker images: some secret value/file is needed (temporary, for the duration of the build), and you are puzzled how to pass it w/o over-exposing, and make it accessible down the road, when the image becomes publicly available.