Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
.git
.gitignore
fastapi_app/.env
deploy/docker.env
deploy/profiles/*.env
__pycache__/
*.pyc
*.pyo
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -328,3 +328,4 @@ deploy/precise_clean.sh
# Runtime temp directories
/tmp*/
/outputs/system/tmp/
deploy/docker.env
49 changes: 49 additions & 0 deletions DEPLOY.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,52 @@
# Paper2Any Deployment

## 0. 运行前依赖边界

这个项目现在需要区分 4 类依赖,不要再把它们都塞进一个 requirements 里:

- `requirements-base.txt`
通用 Python 运行时依赖。
- `requirements-paper.txt`
论文 / PDF / 科研绘图相关额外 Python 包。
- `requirements-cu12.txt`
NVIDIA Linux + CUDA 12 的额外 GPU 运行时包。
- `requirements-system-ubuntu.txt`
Ubuntu/Debian 系统工具包名,不是 Python 包。

几个关键事实:

- `ffmpeg`
- `libreoffice/soffice`
- `inkscape`
- `poppler-utils`
- `wkhtmltopdf`
- `tectonic`

这些都不是 `pip` 包。

当前 `deploy/start.sh` / `deploy/start_nv.sh` / `deploy/start_muxi.sh` 只负责:

- 读取 profile
- 选择 Python
- 校验部分 Python 运行时
- 启动模型服务 / 后端 / 前端

它们**不会自动安装系统包**,也**不会自动安装 npm / conda / pip 依赖**。

## 1. 配置文件职责

## 0. 先决定用哪套 `.env`

现在推荐先做这个选择:

- **粗粒度模式**:`fastapi_app/.env.simple.example` + `frontend-workflow/.env.simple.example`
- **细粒度模式**:`fastapi_app/.env.example` + `frontend-workflow/.env.example`

建议:

- 大多数部署直接先用粗粒度模式
- 只有需要逐个 workflow 控模型/provider 时,再切细粒度模式

这个项目现在只保留三类配置文件,各管各的,不要重复写同一套 URL / key。

### `fastapi_app/.env`
Expand Down Expand Up @@ -264,6 +309,10 @@ bash deploy/stop_stack.sh
### 仅启动后端

```bash
set -a
source deploy/profiles/nv.env
set +a

bash deploy/start.sh
```

Expand Down
21 changes: 16 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
FROM python:3.11-slim
ARG PYTHON_BASE_IMAGE=python:3.11-slim
FROM ${PYTHON_BASE_IMAGE}

ARG INSTALL_CUDA=0

WORKDIR /app

ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PIP_NO_CACHE_DIR=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1
PIP_DISABLE_PIP_VERSION_CHECK=1 \
PIP_ROOT_USER_ACTION=ignore \
PAPER2ANY_RUNTIME_TMPDIR=/app/outputs/system/tmp

RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
curl \
ffmpeg \
git \
inkscape \
libgl1 \
Expand All @@ -29,13 +36,17 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
&& rm wkhtmltox_0.12.6.1-3.bookworm_amd64.deb \
&& rm -rf /var/lib/apt/lists/*

COPY requirements-base.txt requirements-paper.txt requirements-paper-backup.txt ./
COPY requirements-base.txt requirements-paper.txt requirements-paper-backup.txt requirements-cu12.txt ./

RUN pip install --upgrade pip && \
(pip install -r requirements-paper.txt || pip install -r requirements-paper-backup.txt)
pip install -r requirements-paper.txt && \
if [ "$INSTALL_CUDA" = "1" ]; then pip install -r requirements-cu12.txt; fi

COPY . .

RUN pip install -e . && \
mkdir -p /app/outputs/system/tmp /app/models /app/logs /app/data /app/database /app/raw_data_store /app/rebuttal_sessions

EXPOSE 8000

CMD ["uvicorn", "fastapi_app.main:app", "--host", "0.0.0.0", "--port", "8000"]
CMD ["python", "-m", "uvicorn", "fastapi_app.main:app", "--host", "0.0.0.0", "--port", "8000"]
Loading