| FROM python:3.12-slim | |
| RUN apt-get update && apt-get install -y git curl && rm -rf /var/lib/apt/lists/* | |
| RUN pip install uv --no-cache-dir | |
| # 克隆 v1.5.0 稳定版 | |
| RUN git clone --branch v1.5.3 https://github.com/chenyme/grok2api /app | |
| WORKDIR /app | |
| # 安装项目依赖 | |
| RUN uv sync | |
| # --- 核心修复:显式安装 granian 确保命令存在 --- | |
| RUN uv pip install granian | |
| # -------------------------------------------- | |
| RUN mkdir -p /tmp/data /tmp/logs | |
| COPY entrypoint.sh /app/entrypoint.sh | |
| RUN chmod +x /app/entrypoint.sh | |
| ENV DATA_DIR=/tmp/data | |
| ENV LOG_FILE_ENABLED=false | |
| ENV LOG_LEVEL=INFO | |
| EXPOSE 7860 | |
| CMD ["/app/entrypoint.sh"] |