fix:新增工作流
This commit is contained in:
20
server/.dockerignore
Normal file
20
server/.dockerignore
Normal 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
27
server/Dockerfile
Normal 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"]
|
||||
Reference in New Issue
Block a user