Spaces:
Runtime error
Runtime error
Create Dockerfile
Browse files12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849# 使用 Python 3.11 作为基础镜像 FROM python:3.11-slim # 设置工作目录 WORKDIR /app # 设置环境变量 ENV PYTHONUNBUFFERED=1 \ PYTHONDONTWRITEBYTECODE=1 \ PIP_NO_CACHE_DIR=1 \ PIP_DISABLE_PIP_VERSION_CHECK=1 # 安装系统依赖 RUN apt-get update && \ apt-get install -y --no-install-recommends \ gcc \ && rm -rf /var/lib/apt/lists/* # 复制项目文件 COPY app.py . COPY auth_flow.py . COPY replicate.py . COPY templates/ ./templates/ COPY frontend/ ./frontend/ # 安装 Python 依赖 # 根据项目导入的包创建依赖列表 RUN pip install --no-cache-dir \ fastapi \ uvicorn[standard] \ pydantic \ python-dotenv \ requests # 创建数据目录(用于 SQLite 数据库) RUN mkdir -p /app/data # 复制环境变量配置文件(可选) COPY .env.example .env.example # 暴露端口 EXPOSE 8000 # 健康检查 HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ CMD python -c "import requests; requests.get('http://localhost:8000/healthz', timeout=5)" || exit 1 # 启动命令 CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]DockerfileAdded+49