wechat-ner-re / Dockerfile
chen666-666's picture
Upload 3 files
fb7b761 verified
raw
history blame contribute delete
902 Bytes
# 使用更小的基础镜像 python:3.10-slim-buster,减少镜像体积
FROM python:3.10-slim-buster
# 设置工作目录
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/*
# 复制 requirements.txt 文件先安装 Python 依赖,减少不必要的层
COPY requirements.txt /app/
# 安装 Python 依赖
RUN pip install --no-cache-dir -r requirements.txt
# 复制剩余应用代码到容器中
COPY . /app
# 暴露端口(假设 Gradio 应用在 7860 端口运行)
EXPOSE 7860
# 设置环境变量,确保 Python 输出不缓冲
ENV PYTHONUNBUFFERED=1
# 设置默认命令,启动应用
CMD ["python", "app.py"]