StarrySkyWorld commited on
Commit
d371adc
·
verified ·
1 Parent(s): df4f314

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +39 -0
Dockerfile ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # 使用 Python 3.10 基础镜像
2
+ FROM python:3.10-slim
3
+
4
+ # 安装 Camoufox/Firefox 运行必备的系统库
5
+ RUN apt-get update && apt-get install -y \
6
+ libgtk-3-0 \
7
+ libdbus-glib-1-2 \
8
+ libxt6 \
9
+ libx11-xcb1 \
10
+ libasound2 \
11
+ libglib2.0-0 \
12
+ libnss3 \
13
+ libxcomposite1 \
14
+ libxdamage1 \
15
+ libxext6 \
16
+ libxfixes3 \
17
+ libxrandr2 \
18
+ libgbm1 \
19
+ libpango-1.0-0 \
20
+ libcairo2 \
21
+ && rm -rf /var/lib/apt/lists/*
22
+
23
+ WORKDIR /app
24
+
25
+ # 复制项目文件
26
+ COPY . .
27
+
28
+ # 安装 Python 包
29
+ RUN pip install --no-cache-dir -r requirements.txt
30
+
31
+ # 重要:提前下载 Camoufox 浏览器二进制文件
32
+ # 这样可以避免在 HF Space 启动时因下载大文件导致超时
33
+ RUN python -m camoufox fetch
34
+
35
+ # 暴露 HF 默认端口
36
+ EXPOSE 7860
37
+
38
+ # 启动命令:强制指定浏览器类型为 camoufox
39
+ CMD ["python", "api_solver.py", "--host", "0.0.0.0", "--port", "7860", "--browser_type", "camoufox", "--thread", "5", "--debug"]