How can I install a private repo inside a python image docker? I tried many alternatives but all were unsuccesful. Seems I cant get to set ssh credentials inside a python based image.
My Docker image:
FROM python:3.8
ENV PATH="/scripts:${PATH}"
# Django files
COPY ./requirements.txt /requirements.txt
RUN pip install --upgrade pip
RUN pip install -r requirements.txt
the requirements file has:
git+ssh://[email protected]/my_repo_name.git@dev
And build is triggered from aocker compose file:
....
django_service:
build:
context: ..
dockerfile: Dockerfile
volumes:
- static_data:/vol/web
environment:
- SECRET_KEY=${SECRET_KEY}
depends_on:
....
Perhaps you could use https instead of ssh:
git clone https://${GH_TOKEN}@github.com/username/my_repo_name.git@dev
To set the token inside the Dockerfile use: ARG GH_TOKEN
To keep the token outside the Dockerfile you can build your docker
image with passing the arg like this --build-arg GH_TOKEN=MY_TOKEN
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With