chore: Docker/Nginx 部署产物与 1Panel 指南

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
浅念
2026-09-15 21:32:20 +08:00
parent 1cb199e99e
commit 7ed55c8a8d
7 changed files with 241 additions and 0 deletions
+6
View File
@@ -0,0 +1,6 @@
.venv/
db.sqlite3
__pycache__/
.cache/
.pytest_cache/
tracker/data/*.xdb
+11
View File
@@ -0,0 +1,11 @@
FROM python:3.12-slim
WORKDIR /app
# 先只拷 requirements 加装依赖层,业务代码改动不触发重装
COPY requirements.txt .
# 大陆网络备用源:清华 pypi 镜像
RUN pip install --no-cache-dir -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
COPY . .
EXPOSE 8000
# 启动即 migrate(单副本场景简单可靠),随后 gunicorn 3 worker
# --forwarded-allow-ips=*:信任前置 Nginx 传入的 X-Forwarded-For(DRF NUM_PROXIES=1 取末段还原客户端 IP)
CMD ["sh", "-c", "python manage.py migrate && gunicorn config.wsgi:application -b 0.0.0.0:8000 -w 3 --forwarded-allow-ips=*"]