Download Dockerfile from gallyg/code2: direct link, hf CLI and curl.
- Browser
- Download file 933 Bytes
-
https://huggingface.co/spaces/gallyg/code2/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/gallyg/code2/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/gallyg/code2/resolve/main/Dockerfile
933 Bytes
| FROM python:3.11-slim | |
| # 安装系统基础工具 | |
| RUN apt-get update && apt-get install -y git curl && rm -rf /var/lib/apt/lists/* | |
| RUN useradd -m -u 1000 user | |
| WORKDIR /app | |
| USER root | |
| # 克隆项目 | |
| RUN git clone https://github.com/dou-jiang/codex-console.git . | |
| # 复制同步脚本 | |
| COPY sync_run.py /app/sync_run.py | |
| RUN chown -R user:user /app && chmod +x /app/sync_run.py | |
| USER user | |
| ENV PATH="/home/user/.local/bin:$PATH" | |
| # --- 关键修复步骤 --- | |
| # 1. 先安装项目自带的依赖 | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # 2. 强制安装黄金组合:既保留新版 Pydantic V2,又锁死兼容的 Starlette 0.27.0 | |
| RUN pip install --no-cache-dir --force-reinstall \ | |
| "fastapi==0.104.1" \ | |
| "starlette==0.27.0" \ | |
| "pydantic>=2.4.0" \ | |
| "huggingface_hub" | |
| RUN mkdir -p data logs output | |
| EXPOSE 7860 | |
| # 启动同步脚本(注意 CMD 后面的空格已经补上) | |
| CMD ["python", "/app/sync_run.py"] |