fbc3cc84f0
把项目打包成可部署的数据同步服务: - Dockerfile (multi-stage builder/runtime, slim base, 含 healthcheck) - docker-compose.yml (postgres:16-alpine + market_sync, 持久化 pgdata + logs) - .dockerignore (减 build context) - bin/service_run.sh (单进程跑 uvicorn + scheduler 线程) - app/entrypoints/worker.py 抽 start_scheduler_thread() (幂等) 部署: docker compose up -d # 然后访问 http://localhost:8100/docs 看 FastAPI 设计选择: - 单容器一服务(uvicorn 主 + scheduler daemon thread),不用 supervisord - 原 systemd timer 由进程内 scheduler 取代(配置已存在于 config 表) - PG 用 docker volume 持久化;同步日志单独 volume
31 lines
346 B
Plaintext
31 lines
346 B
Plaintext
# .dockerignore — 减小 build context
|
|
.git
|
|
.github
|
|
.vscode
|
|
.idea
|
|
.claude
|
|
.venv
|
|
venv
|
|
__pycache__
|
|
*.pyc
|
|
*.pyo
|
|
*.pyd
|
|
.pytest_cache
|
|
.mypy_cache
|
|
.ruff_cache
|
|
.coverage
|
|
htmlcov/
|
|
*.log
|
|
logs/
|
|
.DS_Store
|
|
*.swp
|
|
*.swo
|
|
node_modules
|
|
frontend/node_modules
|
|
tests/
|
|
docs/
|
|
*.md
|
|
!README.md
|
|
# 已通过 requirements.txt 装好,不重复打包
|
|
**/*.tar.gz
|
|
**/*.whl |