update: add common
This commit is contained in:
@@ -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"]
|
||||||
@@ -21,6 +21,10 @@ backend = "backend:main"
|
|||||||
url = "https://pypi.tuna.tsinghua.edu.cn/simple/"
|
url = "https://pypi.tuna.tsinghua.edu.cn/simple/"
|
||||||
default = true
|
default = true
|
||||||
|
|
||||||
|
[tool.uv.sources]
|
||||||
|
common = { workspace = true }
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["uv_build>=0.11.31,<0.12.0"]
|
requires = ["hatchling"]
|
||||||
build-backend = "uv_build"
|
build-backend = "hatchling.build"
|
||||||
|
|
||||||
|
|||||||
@@ -9,9 +9,10 @@ authors = [
|
|||||||
requires-python = ">=3.12"
|
requires-python = ">=3.12"
|
||||||
dependencies = []
|
dependencies = []
|
||||||
|
|
||||||
[project.scripts]
|
|
||||||
common = "common:main"
|
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["uv_build>=0.11.31,<0.12.0"]
|
requires = ["hatchling"]
|
||||||
build-backend = "uv_build"
|
build-backend = "hatchling.build"
|
||||||
|
|
||||||
|
|
||||||
|
[tool.hatch.build.targets.wheel]
|
||||||
|
packages = ["src/common"]
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
# coding=utf-8
|
||||||
|
"""
|
||||||
|
@Time :2026/7/27
|
||||||
|
@Author :tao.chen
|
||||||
|
"""
|
||||||
|
def hello_world():
|
||||||
|
return 'Hello World!'
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
version: '3.8'
|
||||||
|
|
||||||
|
services:
|
||||||
|
backend:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: backend/Dockerfile
|
||||||
|
ports:
|
||||||
|
- "8000:8000"
|
||||||
|
environment:
|
||||||
|
- RUNTIME_BASE_URL=http://runtime:8001
|
||||||
|
depends_on:
|
||||||
|
- runtime
|
||||||
|
|
||||||
|
runtime:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: runtime/Dockerfile
|
||||||
|
ports:
|
||||||
|
- "8001:8001"
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
# runtime/Dockerfile
|
||||||
|
FROM python:3.12-slim
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# 安装 uv
|
||||||
|
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv
|
||||||
|
|
||||||
|
|
||||||
|
COPY pyproject.toml uv.lock ./
|
||||||
|
|
||||||
|
COPY common ./common
|
||||||
|
COPY runtime ./runtime
|
||||||
|
|
||||||
|
RUN uv sync --frozen --no-dev --package backend
|
||||||
|
|
||||||
|
EXPOSE 8001
|
||||||
|
|
||||||
|
CMD ["uv", "run", "--package", "runtime", "uvicorn", "runtime.main:app", "--host", "0.0.0.0", "--port", "8001"]
|
||||||
@@ -19,6 +19,9 @@ dependencies = [
|
|||||||
url = "https://pypi.tuna.tsinghua.edu.cn/simple/"
|
url = "https://pypi.tuna.tsinghua.edu.cn/simple/"
|
||||||
default = true
|
default = true
|
||||||
|
|
||||||
|
[tool.uv.sources]
|
||||||
|
common = { workspace = true }
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["uv_build>=0.11.31,<0.12.0"]
|
requires = ["hatchling"]
|
||||||
build-backend = "uv_build"
|
build-backend = "hatchling.build"
|
||||||
@@ -9,6 +9,7 @@ resolution-markers = [
|
|||||||
[manifest]
|
[manifest]
|
||||||
members = [
|
members = [
|
||||||
"backend",
|
"backend",
|
||||||
|
"common",
|
||||||
"model-platform",
|
"model-platform",
|
||||||
"runtime",
|
"runtime",
|
||||||
]
|
]
|
||||||
@@ -379,6 +380,11 @@ wheels = [
|
|||||||
{ url = "https://pypi.tuna.tsinghua.edu.cn/packages/60/97/891a0971e1e4a8c5d2b20bbe0e524dc04548d2307fee33cdeba148fd4fc7/comm-0.2.3-py3-none-any.whl", hash = "sha256:c615d91d75f7f04f095b30d1c1711babd43bdc6419c1be9886a85f2f4e489417", size = 7294, upload-time = "2025-07-25T14:02:02.896Z" },
|
{ url = "https://pypi.tuna.tsinghua.edu.cn/packages/60/97/891a0971e1e4a8c5d2b20bbe0e524dc04548d2307fee33cdeba148fd4fc7/comm-0.2.3-py3-none-any.whl", hash = "sha256:c615d91d75f7f04f095b30d1c1711babd43bdc6419c1be9886a85f2f4e489417", size = 7294, upload-time = "2025-07-25T14:02:02.896Z" },
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "common"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = { editable = "common" }
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "debugpy"
|
name = "debugpy"
|
||||||
version = "1.8.21"
|
version = "1.8.21"
|
||||||
|
|||||||
Reference in New Issue
Block a user