Goal: Install a package from a private bitbucket repository, using npm, from within a docker build script.
- Add a project from a private repo to your package.json. For example:
git+ssh://[email protected]/hamweather/private-repo - Generate ssh keys using
ssh-keygen(see https://confluence.atlassian.com/bitbucket/set-up-ssh-for-git-728138079.html) - Save the public key to the bitbucket repo you want to install (see
Settings > Deployment Keys) - Commit the private key to your repo
- Commit the
ssh-bitbucket.shscript to your repo - Add executable permissions to
ssh-bitbucket.sh - Set permissionson the private key to
0600 - Update your Dockerfile, as described below
At line 4 we are copying bitbucket_ssh_key
COPY ./bitbucket_ssh_key /opt/my-appBut at line 16, we are deleting bitbucket_rsa
RUN rm ./bitbucket_rsaIs that an error? Should have been there "rm ./bitbucket_ssh_key" ?