I am working on a project which has dependency on another project.
In live environment, the dependency is published and installed simply using pip install. On my local environment, I'd like to be able to install the local dependency instead, using the pip install -e command.
The structure is as follow:
- Home
--- Project1
----- docker-compose
----- Dockerfile
--- relaton-py
In this structure, Project1 has dependency on relaton-py, thus I'd like to "install" this dependency using the local relaton-py.
My docker-compose file looks like:
volumes:
- .:/code
- /Users/myuser/Dev/Projects/relaton-py:/relaton-py
while the Dockerfile looks like:
COPY requirements.txt /code/requirements.txt
RUN ["pip", "install", "-e", "relaton-py"]
WORKDIR /code
RUN ["pip", "install", "-r", "requirements.txt"]
# Copy the rest of the codebase
COPY . /code
When trying to spin un the environment, I get the following error:
=> ERROR [local/web-precheck:latest 11/19] RUN ["pip", "install", "-e", "relaton-py"] 1.2s
------
> [local/web-precheck:latest 11/19] RUN ["pip", "install", "-e", "relaton-py"]:
#27 0.685 ERROR: relaton-py is not a valid editable requirement. It should either be a path to a local project or a VCS URL (beginning with bzr+http, bzr+https, bzr+ssh, bzr+sftp, bzr+ftp, bzr+lp, bzr+file, git+http, git+https, git+ssh, git+git, git+file, hg+file, hg+http, hg+https, hg+ssh, hg+static-http, svn+ssh, svn+http, svn+https, svn+svn, svn+file).
#27 0.889 WARNING: You are using pip version 22.0.4; however, version 22.1.2 is available.
#27 0.889 You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
------
failed to solve: rpc error: code = Unknown desc = executor failed running [pip install -e relaton-py]: exit code: 1
However, if I try not to install this local dependency in the Dockerfile, the entire environment spins up and I am able to access the container and install the package manually with the same command pip install -e relaton-py.
Has anyone had to deal with this sort of thing already? Any idea on how to make Dockerfile recognise the files in the mounted volumes?