If, like me, you like to have your complete javascript build done during the docker build phase, then you may have inevitably, come across the issue of needing to either npm install, yarn install or git checkout from a ssh connected location. At the time that I first encountered this problem I searched google and came across a few examples:

None of these examples seemed to suit my use case or just didn’t seem to work.

So I decided to go back to the drawing board and figure this out myself. It turns out that it is actually quite simple. The documentation for this is pretty much the same as the standard docs you would find for creating SSH keys for github and adding them to the SSH agent. My use case was probably special — I had no intention of the build being triggered on a build server so I wasnt worried about accessing the SSH key and I only really wanted my SSH key to be used and also the docker build command was triggered from a yarn start command so I was able to do something special before the docker build process started. …


Shane Johnson

A dumb redneck developer living it up in the big smoke

Get the Medium app