diff --git a/backend/Dockerfile b/backend/Dockerfile index 24e217f..6e57073 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -14,7 +14,7 @@ COPY common ./common COPY backend ./backend # 3. 安装 backend 及其所有依赖 (包括本地 common) -RUN uv sync --frozen --no-dev --package backend +RUN UV_DEFAULT_INDEX="https://pypi.tuna.tsinghua.edu.cn/simple/" uv sync --frozen --no-dev --no-editable --package backend EXPOSE 8000 diff --git a/backend/pyproject.toml b/backend/pyproject.toml index b19b6f8..88165c2 100644 --- a/backend/pyproject.toml +++ b/backend/pyproject.toml @@ -8,7 +8,9 @@ authors = [ ] requires-python = ">=3.12" dependencies = [ + "boto3>=1.43.57", "fastapi>=0.140.0", + "httpx>=0.28.1", "loguru>=0.7.3", "pydantic>=2.13.4", "uvicorn>=0.51.0", diff --git a/default.conf b/default.conf index 4c86b73..ed4d37c 100644 --- a/default.conf +++ b/default.conf @@ -13,6 +13,8 @@ server { server_name localhost; # 全局或针对存储服务设置最大上传限制 (100G) client_max_body_size 100G; + # 指定 Docker 内置 DNS 解析器,并设置 30 秒缓存 + resolver 127.0.0.11 valid=30s ipv6=off; # ========================================================================= # 1. RustFS 对象存储服务转发 (/storage/) @@ -80,7 +82,7 @@ server { location = /internal-auth { internal; # 打到宿主机的 FastAPI 8000 端口 - proxy_pass http://host.docker.internal:8000/api/v1/auth/jupyter; + proxy_pass http://backend:8000/api/v1/auth/jupyter; proxy_pass_request_body off; proxy_set_header Content-Length ""; diff --git a/docker-compose.yml b/docker-compose.yml index b1c832c..8505ebe 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,16 @@ version: '3.8' services: + web: + image: nginx:alpine + ports: + - "8888:80" + restart: unless-stopped + volumes: + - ./default.conf:/etc/nginx/conf.d/default.conf:ro + depends_on: + - backend + backend: build: context: . @@ -9,6 +19,9 @@ services: - "8000:8000" environment: - RUNTIME_BASE_URL=http://runtime:8001 + volumes: + - ./backend:/app/backend:ro + - ./common:/app/common:ro depends_on: - runtime @@ -19,4 +32,7 @@ services: ports: - "8001:8001" environment: - - PUBLIC_BASE_URL=http://runtime \ No newline at end of file + - PUBLIC_BASE_URL=http://runtime + volumes: + - ./runtime:/app/runtime:ro + - ./common:/app/common:ro \ No newline at end of file diff --git a/runtime/Dockerfile b/runtime/Dockerfile index 61b3080..d372eff 100644 --- a/runtime/Dockerfile +++ b/runtime/Dockerfile @@ -12,7 +12,7 @@ COPY pyproject.toml uv.lock ./ COPY common ./common COPY runtime ./runtime -RUN uv sync --frozen --no-dev --package backend +RUN UV_DEFAULT_INDEX="https://pypi.tuna.tsinghua.edu.cn/simple/" uv sync --frozen --no-dev --no-editable --package runtime EXPOSE 8001 diff --git a/uv.lock b/uv.lock index 76ca3fa..2a19207 100644 --- a/uv.lock +++ b/uv.lock @@ -151,7 +151,9 @@ name = "backend" version = "0.1.0" source = { editable = "backend" } dependencies = [ + { name = "boto3" }, { name = "fastapi" }, + { name = "httpx" }, { name = "loguru" }, { name = "pydantic" }, { name = "uvicorn" }, @@ -159,7 +161,9 @@ dependencies = [ [package.metadata] requires-dist = [ + { name = "boto3", specifier = ">=1.43.57" }, { name = "fastapi", specifier = ">=0.140.0" }, + { name = "httpx", specifier = ">=0.28.1" }, { name = "loguru", specifier = ">=0.7.3" }, { name = "pydantic", specifier = ">=2.13.4" }, { name = "uvicorn", specifier = ">=0.51.0" }, @@ -195,6 +199,34 @@ css = [ { name = "tinycss2" }, ] +[[package]] +name = "boto3" +version = "1.43.57" +source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple/" } +dependencies = [ + { name = "botocore" }, + { name = "jmespath" }, + { name = "s3transfer" }, +] +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/c7/30/324319a914752e4021358ccf8252c04364eb8358f9d41d9c3f021959b363/boto3-1.43.57.tar.gz", hash = "sha256:549c95e45f9b04cf0c69727632dbdda23b84dcd3d0ed7981c6aaff72ef9cb5af", size = 112690, upload-time = "2026-07-27T19:31:09.32Z" } +wheels = [ + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/80/a4/2c4ee25556a997a81ea01073962cf8351da3707412c584d053b3861d09e8/boto3-1.43.57-py3-none-any.whl", hash = "sha256:115ed9cac409d9b57e2437b52fdb4286660d12a2bd44a0f48d530e68623d09a7", size = 140028, upload-time = "2026-07-27T19:31:07.226Z" }, +] + +[[package]] +name = "botocore" +version = "1.43.57" +source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple/" } +dependencies = [ + { name = "jmespath" }, + { name = "python-dateutil" }, + { name = "urllib3" }, +] +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/0b/92/1f8a454cf90bcb0c0e32a25817441cb7f3702fdd76710d7018abad12a2fc/botocore-1.43.57.tar.gz", hash = "sha256:001a5653bebc03b862bde2da63bad4adb0b30072a3f247aba4daae5aa097b546", size = 15739550, upload-time = "2026-07-27T19:30:57.916Z" } +wheels = [ + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/41/7a/1cfe9c296df0fa6e0143c8622b10f21fa8fb9cce25450e9a8e5cf6523e4b/botocore-1.43.57-py3-none-any.whl", hash = "sha256:319c6d79f66c3f3f2b538f7dcdc90e410a15a7bfced1db06479134947e629482", size = 15424433, upload-time = "2026-07-27T19:30:55.08Z" }, +] + [[package]] name = "certifi" version = "2026.7.22" @@ -607,6 +639,15 @@ wheels = [ { url = "https://pypi.tuna.tsinghua.edu.cn/packages/62/a1/3d680cbfd5f4b8f15abc1d571870c5fc3e594bb582bc3b64ea099db13e56/jinja2-3.1.6-py3-none-any.whl", hash = "sha256:85ece4451f492d0c13c5dd7c13a64681a86afae63a5f347908daf103ce6d2f67", size = 134899, upload-time = "2025-03-05T20:05:00.369Z" }, ] +[[package]] +name = "jmespath" +version = "1.1.0" +source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple/" } +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/d3/59/322338183ecda247fb5d1763a6cbe46eff7222eaeebafd9fa65d4bf5cb11/jmespath-1.1.0.tar.gz", hash = "sha256:472c87d80f36026ae83c6ddd0f1d05d4e510134ed462851fd5f754c8c3cbb88d", size = 27377, upload-time = "2026-01-22T16:35:26.279Z" } +wheels = [ + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/14/2f/967ba146e6d58cf6a652da73885f52fc68001525b4197effc174321d70b4/jmespath-1.1.0-py3-none-any.whl", hash = "sha256:a5663118de4908c91729bea0acadca56526eb2698e83de10cd116ae0f4e97c64", size = 20419, upload-time = "2026-01-22T16:35:24.919Z" }, +] + [[package]] name = "json5" version = "0.15.0" @@ -1566,6 +1607,18 @@ requires-dist = [ { name = "uvicorn", specifier = ">=0.51.0" }, ] +[[package]] +name = "s3transfer" +version = "0.19.2" +source = { registry = "https://pypi.tuna.tsinghua.edu.cn/simple/" } +dependencies = [ + { name = "botocore" }, +] +sdist = { url = "https://pypi.tuna.tsinghua.edu.cn/packages/76/43/35e4d8aa320bffe8287fe8f65f578fa2d2db0a64212f0e710dce58267854/s3transfer-0.19.2.tar.gz", hash = "sha256:ba0309fd86be3c27dbf78cdd813c13c5e1df16e5874b99d2535ebbdfb9892993", size = 165592, upload-time = "2026-07-22T19:30:44.432Z" } +wheels = [ + { url = "https://pypi.tuna.tsinghua.edu.cn/packages/bc/e7/5c595c75e9f41a44f30e526eda465ea0b4eec93470e074e4a111b253f13a/s3transfer-0.19.2-py3-none-any.whl", hash = "sha256:d8168eccca828cbb2cd573675333f3bddd254313a9c42494b84c76b539e8ba25", size = 90216, upload-time = "2026-07-22T19:30:43.251Z" }, +] + [[package]] name = "send2trash" version = "2.1.0"