31 lines
725 B
Docker
31 lines
725 B
Docker
# InfoGenie 后端 Docker 镜像
|
|
# 仅包含后端服务,使用 Gunicorn
|
|
|
|
FROM python:3.10-slim
|
|
|
|
# 安装 curl 用于健康检查
|
|
RUN apt-get update && apt-get install -y \
|
|
curl \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# 设置工作目录
|
|
WORKDIR /app
|
|
|
|
# 复制依赖文件
|
|
COPY requirements.txt .
|
|
|
|
# 安装 Python 依赖
|
|
RUN pip install --no-cache-dir -r requirements.txt gunicorn
|
|
|
|
# 复制后端代码
|
|
COPY . .
|
|
|
|
# 创建持久化数据目录
|
|
RUN mkdir -p /app/data/logs
|
|
|
|
# 暴露端口
|
|
EXPOSE 2323
|
|
|
|
# 使用 Gunicorn 启动应用
|
|
CMD ["gunicorn", "--bind", "0.0.0.0:2323", "--workers", "4", "--threads", "2", "--timeout", "120", "--access-logfile", "-", "--error-logfile", "-", "app:app"]
|