'How to pip install private repo on python Docker

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: 
 ....


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source