feat: 添加 Docker 部署配置

通过 Dockerfile 和 docker-compose.yml 提供容器化部署方案。
This commit is contained in:
2026-05-09 14:20:59 +08:00
parent a0a06dfd8c
commit 02ea794015
2 changed files with 28 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
FROM python:3.12-slim
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends \
libpq-dev && \
rm -rf /var/lib/apt/lists/*
COPY pyproject.toml .
RUN pip install --no-cache-dir -e ".[dev]"
COPY . .
EXPOSE 8000
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
+12
View File
@@ -0,0 +1,12 @@
services:
app:
build:
context: ..
dockerfile: docker/Dockerfile
ports:
- "8000:8000"
env_file:
- ../.env
volumes:
- ../logs:/app/logs
restart: unless-stopped