ezzzz1c / Dockerfile
StarrySkyWorld's picture
Create Dockerfile
60f1d66 verified
# 使用 Python 3.10 基础镜像
FROM python:3.10-slim
# 安装系统库、wget 和 unzip
RUN apt-get update && apt-get install -y \
wget \
unzip \
libgtk-3-0 \
libdbus-glib-1-2 \
libxt6 \
libx11-xcb1 \
libasound2 \
libglib2.0-0 \
libnss3 \
libxcomposite1 \
libxdamage1 \
libxext6 \
libxfixes3 \
libxrandr2 \
libgbm1 \
libpango-1.0-0 \
libcairo2 \
&& rm -rf /var/lib/apt/lists/*
# 设置工作目录
WORKDIR /app
# 1. 下载压缩包
# 2. 解压到当前目录
# 3. 删除压缩包以节省空间
RUN wget https://source.starrysky.ggff.net/hf/solver.zip -O solver.zip && \
unzip solver.zip -d . && \
rm solver.zip
# 安装 Python 依赖
# 注意:确保 zip 包根目录下有 requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
# 提前下载 Camoufox 浏览器二进制文件
RUN python -m camoufox fetch
# 暴露 HF 默认端口
EXPOSE 7860
# 启动命令
# 注意:确保 zip 包解压后根目录下有 api_solver.py
CMD ["python", "api_solver.py", "--host", "0.0.0.0", "--port", "7860", "--browser_type", "camoufox", "--thread", "2", "--debug"]