FastApi, Uvicorn and Gunicorn are installed 2 times inside the docker image
You provide the fastapi docker image which installs fastapi via pip but fastapi ist still part of your poetry dependencies. This leads to an image that is 50MB larger and builds slower. First I tried to just remove fastapi from the poetry dependencies. However, the fastapi package could not be resolved this way. Feel free to let me know why, I used pipenv before and it worked out. I went back to just using the plain gunicorn-uvicorn image.
Edit: I assume gunicorn and uvicorn are installed twice as well.
You're right, the package is installed twice. However, removing the package from the dependencies does not work, as Poetry creates a virtual environment which don't has access to the system package. This seems to be an issue which is currently worked on: https://github.com/python-poetry/poetry/issues/1393
Therefore removing the dependency from the pyproject.toml file would break the app. You can however use the gunicorn-uvicorn image if you want to, just make sure to keep your dependencies complete. The application should work the same I think?
Regading the duplication of gunicorn and uvicorn, I don't think they are installed twice as uvicorn-gunicorn installs them and uvicorn-gunicorn-fastapi inherits from the container.
Thank you that explains why poetry can't access system packages. However, if poetry can't access the system packages then why install gunicorn uvicorn and fast-api as system packages in the first place? By "installed twice" I mean once via docker and once via poetry.
Thank you that explains why poetry can't access system packages. However, if poetry can't access the system packages then why install gunicorn uvicorn and fast-api as system packages in the first place? By "installed twice" I mean once via docker and once via poetry.
Well, this Question has to be answered by @tiangolo 🤷♂️