I have the following in my setup.py
entry_points={
'console_scripts': [
'my-app=main:run',
],
and my file structure is
▶ tree -L 2
.
├── Dockerfile
├── README.md
├── redis.conf
├── setup.cfg
├── setup.py
├── src
│ ├── main.py
│ ├── settings.py
│ ├── bfile.py
│ └── afile.py
and in my main.py
def run():
actual_run()
Locally, in a virtualenv when performing
pip install -e . && my-app
it runs smoothly.
However in an image created with the following Dockerfile
FROM python:3.9-slim-buster
WORKDIR /app
COPY . .
RUN pip3 install .
CMD [ "my-app"]
I get
Traceback (most recent call last):
File "/usr/local/bin/my-app", line 5, in <module>
from main import run
ModuleNotFoundError: No module named 'main'
What I noticed, is that in my image, in /usr/local/lib/python3.9/site-packages/ there only the a file named my-app-0.0.1.dist-info and not a dir with the source files.
Why is that?