'ModuleNotFoundError in DOCKER, even though the module is present

file structure

    .
    |
    |-app
      |
      |-main.py
      |-model.py
      |-database.py
    |-Dockerfile
    |-requirements.txt

when i run this in docker it says that model not found. and gives me a module import error.

this is my Dockerfile

    # 
    FROM python:3.9

    # 
    WORKDIR /code

    # 
    COPY ./requirements.txt /code/requirements.txt

    # 
    RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt

    # 
    COPY ./app /code/app

    # 
    CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "80"]

what am i doing wrong? please help.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source