Spaces:
gallyg
/
Configuration error

gallyg commited on
Commit
ded1460
·
verified ·
1 Parent(s): 82b233b

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -4
Dockerfile CHANGED
@@ -1,12 +1,13 @@
1
  FROM python:3.11-slim
2
 
 
3
  RUN apt-get update && apt-get install -y git curl && rm -rf /var/lib/apt/lists/*
4
 
5
  RUN useradd -m -u 1000 user
6
  WORKDIR /app
7
 
8
  USER root
9
- # 克隆项目
10
  RUN git clone https://github.com/dou-jiang/codex-console.git .
11
 
12
  # 复制同步脚本
@@ -16,13 +17,21 @@ RUN chown -R user:user /app && chmod +x /app/sync_run.py
16
  USER user
17
  ENV PATH="/home/user/.local/bin:$PATH"
18
 
19
- # 修复核心】强制安装兼容版本的 Jinja2 和 FastAPI 相关的组件
20
- # 解决 TypeError: unhashable type: 'dict' 错误
21
  RUN pip install --no-cache-dir -r requirements.txt
22
- RUN pip install --no-cache-dir huggingface_hub "jinja2<=3.0.3" "starlette>=0.27.0"
 
 
 
 
 
 
 
23
 
24
  RUN mkdir -p data logs output
25
 
26
  EXPOSE 7860
27
 
 
28
  CMD ["python", "/app/sync_run.py"]
 
1
  FROM python:3.11-slim
2
 
3
+ # 安装系统基础工具
4
  RUN apt-get update && apt-get install -y git curl && rm -rf /var/lib/apt/lists/*
5
 
6
  RUN useradd -m -u 1000 user
7
  WORKDIR /app
8
 
9
  USER root
10
+ # 克隆项目
11
  RUN git clone https://github.com/dou-jiang/codex-console.git .
12
 
13
  # 复制同步脚本
 
17
  USER user
18
  ENV PATH="/home/user/.local/bin:$PATH"
19
 
20
+ # --- 关键修复步骤 ---
21
+ # 1. 先安装项目自带的依赖
22
  RUN pip install --no-cache-dir -r requirements.txt
23
+ # 2. 强制覆盖安装“黄金组合”版本,彻底解决 unhashable type: 'dict'
24
+ # 这三个库的版本必须严格一致,才能兼容旧版 FastAPI 的模板系统
25
+ RUN pip install --no-cache-dir --force-reinstall \
26
+ "Jinja2==3.0.3" \
27
+ "MarkupSafe==2.0.1" \
28
+ "itsdangerous==2.0.1" \
29
+ "starlette>=0.27.0" \
30
+ "huggingface_hub"
31
 
32
  RUN mkdir -p data logs output
33
 
34
  EXPOSE 7860
35
 
36
+ # 启动同步脚本
37
  CMD ["python", "/app/sync_run.py"]