update: add common

This commit is contained in:
tao.chen
2026-07-27 15:37:58 +08:00
parent e56bf0e56b
commit 1c03a32298
8 changed files with 91 additions and 9 deletions
+22
View File
@@ -0,0 +1,22 @@
# backend/Dockerfile
FROM python:3.12-slim
WORKDIR /app
# 安装 uv
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv
# 1. 拷贝根目录配置与 lock 文件
COPY pyproject.toml uv.lock ./
# 2. 拷贝 common 模块与 backend 模块
COPY common ./common
COPY backend ./backend
# 3. 安装 backend 及其所有依赖 (包括本地 common)
RUN uv sync --frozen --no-dev --package backend
EXPOSE 8000
# 4. 启动服务 (通过 uv run 指定运行 backend 包)
CMD ["uv", "run", "--package", "backend", "uvicorn", "backend.main:app", "--host", "0.0.0.0", "--port", "8000"]
+6 -2
View File
@@ -21,6 +21,10 @@ backend = "backend:main"
url = "https://pypi.tuna.tsinghua.edu.cn/simple/"
default = true
[tool.uv.sources]
common = { workspace = true }
[build-system]
requires = ["uv_build>=0.11.31,<0.12.0"]
build-backend = "uv_build"
requires = ["hatchling"]
build-backend = "hatchling.build"