chore: psycopg 改用 binary extra,精简 Dockerfile 的 apt 依赖

psycopg[binary] 替代并列声明的 psycopg + psycopg-binary。上游的
binary extra 是 psycopg-binary==<同版本> 的精确 pin,而原来两条各自
带范围,没有东西保证它们同步——单独升级其中一个就可能凑出上游没测过
的组合。解析结果不变,requirements.txt 只多了 extra 自带的
implementation_name != 'pypy' 标记。

apt 依赖从 10 个降到 4 个:
- curl / unzip / openssl:全仓库零引用。解压走 Python zipfile,
  健康检查走 xmlrpc,openssl 装的是 CLI 而 Python 要的是 libssl
- libpq5:psycopg_binary.libs 自带 libpq.so.5.18,容器内实测
  psycopg.pq.__impl__ == binary
- libjpeg62-turbo:pillow.libs 自带 libjpeg.so.62
- zlib1g:base 镜像的 CPython 已经带着

保留 ca-certificates(smtplib 走 TLS 时读系统信任库,不是 certifi)、
clang-format(submission/utils.py 调用)、passwd(entrypoint 建账号)、
supervisor。

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-05 23:11:33 -06:00
parent 8557f8a5f5
commit 8d35d5c2de
4 changed files with 13 additions and 15 deletions

11
uv.lock generated
View File

@@ -395,8 +395,7 @@ dependencies = [
{ name = "jieba" },
{ name = "openai" },
{ name = "pillow" },
{ name = "psycopg" },
{ name = "psycopg-binary" },
{ name = "psycopg", extra = ["binary"] },
{ name = "sentry-sdk", extra = ["django"] },
{ name = "tree-sitter" },
{ name = "tree-sitter-c" },
@@ -425,8 +424,7 @@ requires-dist = [
{ name = "jieba", specifier = ">=0.42.1" },
{ name = "openai", specifier = ">=2.34.0,<3" },
{ name = "pillow", specifier = ">=12.2.0,<13" },
{ name = "psycopg", specifier = ">=3.3.4,<4" },
{ name = "psycopg-binary", specifier = ">=3.3.4,<4" },
{ name = "psycopg", extras = ["binary"], specifier = ">=3.3.4,<4" },
{ name = "sentry-sdk", extras = ["django"], specifier = ">=2.0.0,<3" },
{ name = "tree-sitter", specifier = ">=0.25.2" },
{ name = "tree-sitter-c", specifier = ">=0.24.2" },
@@ -548,6 +546,11 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/5c/e0/7b3dee031daae7743609ce3c746565d4a3ed7c2c186479eb48e34e838c64/psycopg-3.3.4-py3-none-any.whl", hash = "sha256:b6bbc25ccf05c8fad3b061d9db2ef0909a555171b84b07f29458a447253d679a", size = 213001, upload-time = "2026-05-01T23:20:50.816Z" },
]
[package.optional-dependencies]
binary = [
{ name = "psycopg-binary", marker = "implementation_name != 'pypy'" },
]
[[package]]
name = "psycopg-binary"
version = "3.3.4"