Spaces:
Sleeping
Sleeping
| FROM python:3.11-slim | |
| WORKDIR /app | |
| # 系统依赖 | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| git curl && rm -rf /var/lib/apt/lists/* | |
| # Python依赖 | |
| RUN pip install --no-cache-dir \ | |
| torch torchvision --index-url https://download.pytorch.org/whl/cpu && \ | |
| pip install --no-cache-dir \ | |
| fastapi uvicorn tokenizers numpy requests huggingface_hub | |
| # 创建符号链接: /home/admin/swarm -> /app (兼容所有硬编码路径) | |
| RUN mkdir -p /home/admin && ln -s /app /home/admin/swarm | |
| # 复制代码 | |
| COPY core/ core/ | |
| COPY training/__init__.py training/__init__.py | |
| COPY training/model.py training/model.py | |
| COPY training/tokenizer.py training/tokenizer.py | |
| COPY training/models/ training/models/ | |
| COPY training/data/__init__.py training/data/__init__.py | |
| COPY training/data/all_training.jsonl training/data/all_training.jsonl | |
| COPY web_app.py . | |
| COPY hf_app.py . | |
| # 环境变量 | |
| ENV PYTHONUNBUFFERED=1 | |
| ENV PYTHONPATH=/app | |
| # 端口 | |
| EXPOSE 7860 | |
| # 启动 | |
| CMD ["python", "hf_app.py"] | |