python-monorepo icon indicating copy to clipboard operation
python-monorepo copied to clipboard

relative paths fail in Dockerfile

Open nareto opened this issue 3 years ago • 1 comments

How do you manage relative paths in pyproject.toml when you dockerize the project? For example in project-one there is

lib-one = {path = "../../libs/lib-one"}

This of course makes docker build fail with a simple Dockerfile like the following

FROM python:3.9

WORKDIR /code
RUN pip install poetry==1.1.13

COPY ./pyproject.toml ./poetry.lock* /code/
RUN poetry install --no-dev

COPY ./src /code

nareto avatar Jun 15 '22 08:06 nareto

@nareto, this also stumped me at first but what you need to do is build from the context of the repo root, not the project root.

See this comment on the medium article: https://medium.com/@d5h/hi-yannick-d10971103853

JoshHayes avatar Jul 12 '22 13:07 JoshHayes