Search code examples
pythondockerpip

pip install git+url within a docker environment


I am using this Docker (FROM lambci/lambda:python3.6) and I need to install a private repository package. The problem is the Docker does not have git and I can not install git using apt-get or apk install because the Docker is not Linux.

Is there any possible way to fix this installing git? Or is there any other better method I could use to install this private repository package?


Solution

  • add this to makefile:

    # makefile
    git clone REPO
    cd REPO_DIR; python setup.py bdist_wheel
    cp REPO_DIR/dist/* .
    rm -rf REPO_DIR/
    

    add this to dockerfile:

    # dockerfile
    RUN pip install REPO*.whl
    

    and then the package is successfully installed within docker