fix: offline deploy

This commit is contained in:
tao.chen
2026-08-17 15:30:21 +08:00
parent cbfbee7fe0
commit 0974881fbb
4 changed files with 16 additions and 9 deletions
+3 -1
View File
@@ -2,6 +2,8 @@ FROM python-base:3.12
ENV UV_HTTP_TIMEOUT=300
ENV UV_DEFAULT_INDEX=https://pypi.tuna.tsinghua.edu.cn/simple/
ENV UV_OFFLINE=1
ENV UV_NO_SYNC=1
COPY common/pyproject.toml common/pyproject.toml
COPY backend/pyproject.toml backend/pyproject.toml
@@ -17,4 +19,4 @@ RUN uv sync --frozen --no-dev --package backend
EXPOSE 8000
CMD ["gunicorn", "--config", "backend/gunicorn.conf.py", "backend.main:app"]
CMD ["uv", "run", "--frozen", "--no-dev", "--package", "backend", "gunicorn", "--config", "backend/gunicorn.conf.py", "backend.main:app"]
+7 -6
View File
@@ -3,6 +3,7 @@ services:
build:
context: .
dockerfile: backend/Dockerfile
image: model-development-backend:latest
logging:
driver: json-file
options:
@@ -13,6 +14,7 @@ services:
- uv
- run
- --frozen
- --no-dev
- --package
- backend
- alembic
@@ -26,6 +28,7 @@ services:
build:
context: .
dockerfile: frontend/Dockerfile
image: model-development-web:latest
logging:
driver: json-file
options:
@@ -59,6 +62,7 @@ services:
build:
context: .
dockerfile: backend/Dockerfile
image: model-development-backend:latest
logging:
driver: json-file
options:
@@ -110,6 +114,7 @@ services:
build:
context: .
dockerfile: runtime/Dockerfile
image: model-development-runtime:latest
logging:
driver: json-file
options:
@@ -154,12 +159,7 @@ services:
# bind mount instead. In s3 mode the grep succeeds (mount must be up or
# startup would have crashed). In local mode the grep fails (no fuse.rclone)
# so the || branch runs: just verify /data/workspace is a directory.
test:
- CMD-SHELL
- |
grep -q ' /data/workspace .* - fuse.rclone ' /proc/self/mountinfo \
&& curl -fsS http://127.0.0.1:8000/api/v1/health \
|| { [ -d /data/workspace ] && curl -fsS http://127.0.0.1:8000/api/v1/health; }
test: [ "CMD-SHELL", "curl -fsS http://127.0.0.1:8000/api/v1/health >/dev/null" ]
interval: 10s
timeout: 5s
retries: 18
@@ -169,6 +169,7 @@ services:
build:
context: .
dockerfile: schedule/Dockerfile
image: model-development-schedule:latest
logging:
driver: json-file
options:
+3 -1
View File
@@ -2,6 +2,8 @@ FROM python-base:3.12
ENV UV_HTTP_TIMEOUT=300
ENV UV_DEFAULT_INDEX=https://pypi.tuna.tsinghua.edu.cn/simple/
ENV UV_OFFLINE=1
ENV UV_NO_SYNC=1
# 从官方 Rclone 镜像直接复制 rclone 二进制文件(高效、稳定)
COPY --from=rclone/rclone:latest /usr/local/bin/rclone /usr/local/bin/rclone
@@ -44,4 +46,4 @@ RUN mkdir -p /root/.jupyter/custom /app/.venv/share/jupyter/custom && \
EXPOSE 8000
CMD ["uv", "run", "--frozen", "--package", "runtime", "gunicorn", "--config", "runtime/gunicorn.conf.py", "runtime.main:app"]
CMD ["uv", "run", "--frozen", "--no-dev", "--package", "runtime", "gunicorn", "--config", "runtime/gunicorn.conf.py", "runtime.main:app"]
+3 -1
View File
@@ -2,6 +2,8 @@ FROM python-base:3.12
ENV UV_HTTP_TIMEOUT=300
ENV UV_DEFAULT_INDEX=https://pypi.tuna.tsinghua.edu.cn/simple/
ENV UV_OFFLINE=1
ENV UV_NO_SYNC=1
COPY pyproject.toml uv.lock ./
COPY common/pyproject.toml common/pyproject.toml
@@ -35,4 +37,4 @@ RUN uv venv --python 3.8 /opt/venv/python3.8 && \
--display-name="Python 3.8"
EXPOSE 8000
CMD ["uv", "run", "--frozen", "--package", "schedule", "gunicorn", "--config", "schedule/gunicorn.conf.py", "schedule.main:app"]
CMD ["uv", "run", "--frozen", "--no-dev", "--package", "schedule", "gunicorn", "--config", "schedule/gunicorn.conf.py", "schedule.main:app"]