Remove unused deps and multi-stage Dockerfile with pip

Drop transformers, matplotlib, geopy, and diskcache (~560MB) from
dependencies — none are imported in the codebase. Replace single-stage
poetry-based Docker build with a two-stage pip-based build: builder
stage installs into a venv from an exported requirements.txt, runtime
stage copies only the venv and app code. Eliminates poetry from the
image (fixes ARM segfaults) and removes ~200MB of build tools from
the final image.
This commit is contained in:
Viktor Barzin 2026-02-07 10:48:22 +00:00
parent c76a7ac028
commit 56a7662b8f
No known key found for this signature in database
GPG key ID: 0EB088298288D958
4 changed files with 1897 additions and 766 deletions

View file

@ -8,15 +8,11 @@ authors = ["Kadir Tugan <git@k8n.dev>"]
python = ">3.11"
requests = "^2.31.0"
cachetools = "^5.3.2"
diskcache = "^5.6.3"
tqdm = "^4.66.2"
pillow = "^10.2.0"
numpy = "^1.26.4"
transformers = "^4.38.2"
pytesseract = "^0.3.10"
pandas = "^2.2.1"
geopy = "^2.4.1"
matplotlib = "^3.10.0"
opencv-python = "^4.11.0.86"
click = "^8.2.0"
aiohttp = "^3.11.18"
@ -81,5 +77,5 @@ strict_optional = true
plugins = ["pydantic.mypy"]
[[tool.mypy.overrides]]
module = ["transformers.*", "pytesseract.*", "cv2.*", "celery.*", "tqdm.*", "aiohttp.*", "aiohttp_socks.*", "tenacity.*", "geopy.*", "pandas.*", "numpy.*", "PIL.*", "sqlmodel.*", "sqlalchemy.*", "alembic.*", "apprise.*", "opentelemetry.*", "webauthn.*"]
module = ["pytesseract.*", "cv2.*", "celery.*", "tqdm.*", "aiohttp.*", "aiohttp_socks.*", "tenacity.*", "pandas.*", "numpy.*", "PIL.*", "sqlmodel.*", "sqlalchemy.*", "alembic.*", "apprise.*", "opentelemetry.*", "webauthn.*"]
ignore_missing_imports = true