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.sh
script to your repo - Add executable permissions to
ssh-bitbucket.sh
- Set permissionson the private key to
0600
- Update your Dockerfile, as described below
I think this will be helpful.
https://sanderknape.com/2019/06/installing-private-git-repositories-npm-install-docker/