Using SSH keys during build

I’m trying to use BuildGrid to build an image of PHP app which needs to pull code from a private Bitbucket repository as a step in my Dockerfile. Particularly I need to run composer which in turn uses git to clone from a private repository. The problem is that I need to pass SSH keys so git could get access to the repository. I know that’s an old problem but is there a best practice for this with BuildGrid? I could use Habitus when I build the image locally so I can point to my SSH key files. But I wonder how would I do it with BuildGrid?

After digging in the documentation I can answer this myself. Indeed, Habitus could be used for this task in a way that the key won’t be stored in Docker fisystem layers. There’s an actual example in Habitus documentation.

You must be logged in to answer this question