fix:新增工作流

This commit is contained in:
吕新雨
2026-02-02 21:59:15 +08:00
parent 86e4853709
commit d9a5dbafd6
13 changed files with 275 additions and 98 deletions

20
server/.dockerignore Normal file
View File

@@ -0,0 +1,20 @@
.venv
__pycache__/
*.pyc
*.pyo
*.pyd
.pytest_cache/
.mypy_cache/
.ruff_cache/
# 本地/测试数据
.test.db
*.db
# 测试与开发脚本(按需移除)
tests/
.env*
# Git 元数据
.git/
.gitignore

27
server/Dockerfile Normal file
View File

@@ -0,0 +1,27 @@
FROM python:3.11-slim
# 运行时基础环境
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1
WORKDIR /app
# 系统依赖(按需扩展;多数依赖为纯 Python
RUN apt-get update \
&& apt-get install -y --no-install-recommends build-essential curl \
&& rm -rf /var/lib/apt/lists/*
# 先复制依赖清单以利用 Docker layer cache
COPY requirements.txt /app/requirements.txt
RUN python -m pip install -U pip \
&& pip install --no-cache-dir -r /app/requirements.txt
# 复制后端代码与迁移配置
COPY app /app/app
COPY alembic /app/alembic
COPY alembic.ini /app/alembic.ini
EXPOSE 8000
# 生产镜像默认不开启 reload
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]