Skip to content

Instantly share code, notes, and snippets.

View sambenas's full-sized avatar
👨‍🍳
Cooking up some cool projects.

Samuel Benas sambenas

👨‍🍳
Cooking up some cool projects.
View GitHub Profile
@sambenas
sambenas / install_private_repo_circleci.md
Last active April 19, 2023 15:21
Use pip to install dependencies from a private Github repository inside a docker image build in CircleCI

Pip with private git repository in Dockerfile in CircleCI

Problem: In order to install a dependency using pip that is hosted in a private git repository, an ssh key is needed. When running a docker build command the steps executed inside the Dockerfile are executed in a different shell from the CircleCI commands and they do not have access to the ~/.ssh/id_rsa .

Solution: The private key can be passed to the docker build command as an argument to the Dockerfile and with some Linux commandline magic it can be properly formatted for use by git.

In .circleci/config.yml:

  • setup_remote_docker: