4 ms·
I'm all for smaller images but his final distroless Python image to run Flask is going to fall apart as soon as his Flask app needs to connect to a database. T
by nickjj 5y ago
I'm all for smaller images but his final distroless Python image to run Flask is going to fall apart as soon as his Flask app needs to connect to a database.
That's because the official Python PostgreSQL DB package requires C dependencies which get built and referenced when you install the pg package. You also need certain system libraries to exist on your system in order to build them, such as libpq-dev on a Debian based system.
- otabdeveloper4 5y agoJust use nix, it solves this problem with minimal disruption for the end-user.
- KptMarchewa 5y agoYou can use psycopg2-binary package. Not sure about dynamic dependencies though.
- nickjj 5y ago> You can use psycopg2-binary package. Yep but the author of psycopg2 recommends not using it in production. That's mentioned in the package's docs with "The binary package is a practical choice for development and testing but in production it is advised to use the package built from sources." But more generally, this is only 1 package of many that has a C dependency and requires certain system lib files to run.