My docker container's file structure is the following File structure
Below is my Dockerfile
# syntax=docker/dockerfile:1
FROM python:3.9
WORKDIR /app
RUN pip3 install poetry
ADD ../services/ingest/ ./services/ingest/
ADD ../protos/datapipeline/ ./protos/datapipeline/
WORKDIR /app/services/ingest
RUN poetry install
CMD [ "poetry", "run", "python", "ingest/processor.py"]
I copied the services/ingest and protos/datapipeline folders in such a way that they should be in the same level as in my local machine.
The project also uses poetry with the following line for accessing the python proto files within the pyproject.toml located in the services/ingest folder
datapipeline = {path = "../../protos/datapipeline"}
the container should then go to /app/services/ingest and launch services/ingest/ingest/processor.py using the poetry enviroment which has datapipeline.datapipeline as a module. But running it this way the program cannot locate it even though it works outside the container and produces the following error.
Exception has occurred: ModuleNotFoundError
No module named 'datapipeline.datapipeline'
File "/app/services/ingest/ingest/processor.py", line 9, in <module>
import datapipeline.ingest
Any help or resources would be greatly appreciated on getting this working.
File is imported the following way in processor.py
import datapipeline.ingest