Spaces:
Sleeping
Sleeping
# 使用 python:3.10-slim 作为基础镜像 | |
FROM python:3.10-slim | |
# 设置工作目录 | |
WORKDIR /app | |
# 安装必要的系统依赖 | |
RUN apt-get update && apt-get install -y \ | |
libglib2.0-0 \ | |
libx11-6 \ | |
libxrender1 \ | |
libxext6 \ | |
# 安装中文字体 | |
fonts-noto-cjk \ | |
fonts-wqy-microhei \ | |
# 清理缓存 | |
&& apt-get clean \ | |
&& rm -rf /var/lib/apt/lists/* | |
# 复制当前目录到容器内 | |
COPY . /app | |
# 安装 Python 依赖 | |
RUN pip install --no-cache-dir -r requirements.txt | |
# 暴露端口(假设你的 Gradio 应用在 7860 端口运行) | |
EXPOSE 7860 | |
# 设置环境变量 | |
ENV PYTHONUNBUFFERED=1 | |
# 设置默认命令 | |
CMD ["python", "app.py"] | |