Spaces:
Sleeping
Sleeping
# 使用Python 3.11基础镜像 | |
FROM python:3.11-slim | |
# 设置工作目录 | |
WORKDIR /app | |
# 创建数据和日志目录,并设置权限 | |
RUN mkdir -p /app/data /app/logs /app/data/news && \ | |
chmod -R 777 /app/data /app/logs | |
# 设置环境变量 | |
ENV PYTHONUNBUFFERED=1 \ | |
PYTHONDONTWRITEBYTECODE=1 | |
# 更新源列表并更换为阿里云源 | |
RUN echo 'deb http://mirrors.aliyun.com/debian/ bookworm main' > /etc/apt/sources.list && \ | |
echo 'deb-src http://mirrors.aliyun.com/debian/ bookworm main' >> /etc/apt/sources.list && \ | |
echo 'deb http://mirrors.aliyun.com/debian/ bookworm-updates main' >> /etc/apt/sources.list && \ | |
echo 'deb-src http://mirrors.aliyun.com/debian/ bookworm-updates main' >> /etc/apt/sources.list && \ | |
echo 'deb http://mirrors.aliyun.com/debian-security bookworm-security main' >> /etc/apt/sources.list && \ | |
echo 'deb-src http://mirrors.aliyun.com/debian-security bookworm-security main' >> /etc/apt/sources.list | |
# 安装系统依赖 | |
RUN apt-get update && apt-get install -y --no-install-recommends \ | |
# 在这里添加你的系统依赖 | |
&& rm -rf /var/lib/apt/lists/* | |
# 复制依赖文件 | |
COPY requirements.txt . | |
# 安装Python依赖 | |
RUN pip install --no-cache-dir -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple | |
# 复制应用代码 | |
COPY . . | |
# 运行应用 | |
#CMD ["gunicorn", "app.web.web_server:app", "-b", "0.0.0.0:8888", "--workers", "4"] | |
CMD ["gunicorn", "-c", "gunicorn.conf.py", "app.web.web_server:app"] | |