I am trying to build a dockerfile with Poetry. This is my current file structure:
├── backend_services
│ ├── geocoding
│ │ ├── __init__.py
│ │ ├── application
│ │ ├── Domain
│ │ ├── Infrastructure
│ │ │ ├── rest_api
│ │ │ │ ├── __init__.py
│ │ │ │ ├── app.py
│ │ │ │ ├── tornado_api.py
├── pyproject.toml
├── poetry.lock
└── dockerfile
And my dockerfile looks like this:
FROM python:3.11
RUN mkdir app
WORKDIR /app
COPY pyproject.toml .
RUN pip3 install poetry \
&& poetry config virtualenvs.create false \
&& poetry install --no-interaction
RUN poetry --version
RUN mkdir geocoding
COPY geocoding /app/geocoding
EXPOSE 5000
CMD ["python", "geocoding/infrastructure/rest_api/app.py"]
I have tried different ways to run the file app.py file but everytime I try, I get the same error:
File "/app/geocoding/infrastructure/rest_api/app.py", line 3, in <module>
2023-12-05T14:39:32.158715590Z from geocoding.infrastructure.rest_api.tornado_api import GeocodeHandler
2023-12-05T14:39:32.158719545Z ModuleNotFoundError: No module named 'geocoding'
This error also is shown when I run the app.py through the terminal but not through PyCharm.
Any ideas of why this error shows everytime? Thanks in advance!