21 lines
414 B
Docker
21 lines
414 B
Docker
# 纯后端Docker镜像(前端单独部署)
|
||
FROM python:3.11-slim
|
||
|
||
WORKDIR /app
|
||
|
||
# 复制后端文件
|
||
COPY . .
|
||
|
||
# 安装 Python 依赖
|
||
RUN pip install --no-cache-dir -r requirements.txt && \
|
||
pip install --no-cache-dir gunicorn
|
||
|
||
# 创建持久化数据目录
|
||
RUN mkdir -p /app/data
|
||
|
||
# 暴露端口
|
||
EXPOSE 7878
|
||
|
||
# 启动服务(使用gunicorn)
|
||
CMD ["gunicorn", "-w", "4", "-b", "0.0.0.0:7878", "app:app"]
|