File size: 933 Bytes
d5a09b5
 
2177a43
d5a09b5
 
 
 
085c4b4
 
2177a43
 
085c4b4
2177a43
085c4b4
2177a43
085c4b4
d5a09b5
 
 
2177a43
 
 
 
 
 
 
 
 
 
d5a09b5
2177a43
d5a09b5
47ba321
d5a09b5
2177a43
085c4b4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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"]