I have a python project that I am writing a dockerfile for. This project depends on another python project of mine that is hosted in a private github account of mine.
How do I go about making the dockerfile properly load in the other project as a dependency (using my requirements.txt file)?
I tried copying my private ssh key into the:
/root/.ssh
directory as part of the DockerFile, and including the clone url as part of the requirements.txt file, but this just feels wrong since my private key will be stored in one of the docker image layers.
Are there best practices for this?
Generate a Personal access token .
You should select a scope of this token to limit access to your personal project.
You can pass a token to curl instead of user/password
curl -u <token>:x-oauth-basic
Since Docker API version 1.39+ you can use a different build mode to access your local SSH private key instead of copying it to the image.
See more here: https://stackoverflow.com/a/58883743/435093
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.