Spaces:
Running
Running
FROM python:3.10-slim | |
# 设置缓存路径(与网页配置一致) | |
ENV TRANSFORMERS_CACHE=/model-cache \ | |
PYTHONUNBUFFERED=1 | |
# 创建缓存目录(所有用户可写) | |
RUN mkdir -p /model-cache && chmod 777 /model-cache | |
# 安装系统依赖 | |
RUN apt-get update && apt-get install -y --no-install-recommends gcc python3-dev | |
# 复制代码 | |
WORKDIR /app | |
COPY . . | |
# 安装Python依赖(全局安装) | |
RUN pip install --no-cache-dir -r requirements.txt | |
# 直接使用 root 用户运行(避免权限问题) | |
CMD ["gunicorn", "--bind", "0.0.0.0:8080", "app:app"] |