Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FastApi, Uvicorn and Gunicorn are installed 2 times inside the docker image #280

Open
2start opened this issue Sep 27, 2020 · 3 comments
Open

Comments

@2start
Copy link

2start commented Sep 27, 2020

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.

@2start 2start changed the title Fast api is installed 2 times in the docker image FastApi, Uvicorn and Gunicorn are installed 2 times inside the docker image Sep 27, 2020
@Koschi13
Copy link

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: python-poetry/poetry#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.

@2start
Copy link
Author

2start commented Oct 10, 2020

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.

@Koschi13
Copy link

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 🤷‍♂️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants