Files
aistory-generate/Dockerfile
T
Mai-Vu Tran 6699c516cd first commit
2026-03-16 18:14:44 +07:00

45 lines
977 B
Docker

# AI 小说创作工具 Dockerfile
# 基于 Python 3.11 官方镜像
FROM python:3.11-slim
# 设置工作目录
WORKDIR /app
# 设置环境变量
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV PYTHONPATH=/app
# 安装系统依赖
RUN apt-get update && apt-get install -y \
build-essential \
curl \
git \
&& rm -rf /var/lib/apt/lists/*
# 复制依赖文件
COPY requirements.txt .
COPY requirements-dev.txt .
# 安装 Python 依赖
RUN pip install --no-cache-dir -r requirements.txt
RUN pip install --no-cache-dir -r requirements-dev.txt
# 创建必要的目录
RUN mkdir -p logs cache output data backups templates project_templates plugins
# 复制应用代码
COPY . .
# 设置权限
RUN chmod +x start.sh start.bat run.py
# 暴露端口
EXPOSE 8000
# 健康检查
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://localhost:8000/health || exit 1
# 设置启动命令
CMD ["python", "run.py"]