fix Dockerfile by adapting uv package management

This commit is contained in:
2026-05-15 21:31:03 +08:00
parent 07829fa16e
commit 6f534aafce
+15 -2
View File
@@ -2,8 +2,21 @@ FROM python:3.14-slim
WORKDIR /app
# 安装系统依赖(curl + 构建依赖)
RUN apt-get update && apt-get install -y \
curl \
&& rm -rf /var/lib/apt/lists/*
# 安装 uv
RUN pip install --no-cache-dir uv
# 先复制依赖文件
COPY pyproject.toml uv.lock ./
# 用 uv 安装依赖
RUN uv sync --system
# 再复制代码
COPY . .
RUN pip install --no-cache-dir fastapi uvicorn sqlalchemy psycopg2-binary httpx python-jose
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]