feat: 改造为开箱即用模板 — MySQL/MongoDB(Beanie) 一键切换 + AGENTS.md 开发规范
- src/ 按域组织骨架,示例域 items 双后端实现(SQLAlchemy2.0 async / Beanie 2.x) - DB_BACKEND 环境变量切换,router 只依赖 Repo Protocol - alembic 迁移(含初始 items 迁移)、uv 依赖管理、ruff、pytest 异步测试 - Dockerfile + docker-compose(app/mysql/mongo) - AGENTS.md 重写为本模板开发规范;原最佳实践文档归档 docs/ - 验证:mongodb/mysql 双后端 pytest 全绿 + uvicorn 真实冒烟通过
This commit is contained in:
16
Dockerfile
Normal file
16
Dockerfile
Normal file
@@ -0,0 +1,16 @@
|
||||
FROM python:3.12-slim
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# uv 管理依赖(国内构建加 --index-url 镜像)
|
||||
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
|
||||
|
||||
COPY pyproject.toml uv.lock* ./
|
||||
RUN uv sync --no-dev --no-cache
|
||||
|
||||
COPY src ./src
|
||||
COPY alembic ./alembic
|
||||
COPY alembic.ini ./
|
||||
|
||||
EXPOSE 8000
|
||||
CMD ["uv", "run", "--no-sync", "uvicorn", "src.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||
Reference in New Issue
Block a user