4

I have a small python flask app on a CentOS-7 VM that runs in docker, along with an nginx reverse proxy. The requirements.txt pulls in several external utilities using git+ssh such as:

git+ssh://path-to-our-repo/some-utility.git

I had to make a change to the utility, so I cloned it locally, and I need the app to use my local version. Say the cloned and modified utility is in a local directory:

/var/work/some-utility

In the requirements.txt I changed the entry to:

git+file:///var/work/some-utility

But when I try to run the app with

sudo docker-compose up

I get the error message

Invalid requirement: 'git+file:///var/work/some-utility'
it looks like a path. Does it exist ?

How can I get it to use my local copy of "some-utility" ?

I also tried:

git+file:///var/work/some-utility#egg=someutility

but that produced the same error.

I looked at PIP install from local git repository.

This is related to this question:

https://stackoverflow.com/questions/7225900/how-to-pip-install-packages-according-to-requirements-txt-from-a-local-directory?rq=1

I suppose most people would say why not just check in a development branch of some-utility to the corporate git repo, but in my case I do not have privileges for that.

Or maybe my problem is related to docker, and I need to map the some-utility folder into the docker container, and then use that path? I am a docker noob.

--- Edit ---

Thank you larsks for your answer. I tried to add the some-utility folder to the docker-compose.yml:

volumes:
  - ./some-utility:/usr/local/some-utility

and then changed the requirements.txt to

git+file:///usr/local/some-utility

but our local git repo just went down for maintenance, so I will have to wait a bit for it to come back up to try this.

=== Edit 2 ===

After I made the above changes, I get the following error when running docker-compose when it tries to build my endpoint app:

Cloning file:///usr/local/some-utility to /tmp/pip-yj9xxtae-build
fatal: '/usr/local/some-utility' does not appear to be a git repository

But the /usr/local/some-utility folder does contain the cloned some-utility repo, and I can go there and run git status.

0

1 Answer 1

1

If you're running pip install inside a container, then of course /var/work/some-utility needs to be available inside the container.

You can expose the directory inside your container using a host volume mount, like this:

docker run -v /var/work/some-utility:/var/work/some-utility ...
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.