迁移 PostgreSQL 并新增 Python API 服务

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
fish
2026-05-03 14:58:01 +08:00
parent 750584e619
commit 220f4acc45
10 changed files with 333 additions and 123 deletions

View File

@@ -5,12 +5,12 @@ ENV PYTHONDONTWRITEBYTECODE=1 \
PIP_NO_CACHE_DIR=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
TZ=Asia/Shanghai \
DB_PATH=/app/data/futures.db
DATABASE_URL=postgresql://trade:trade@postgres:5432/futures
WORKDIR /app
# 运行时依赖 + 时区
RUN apk add --no-cache tzdata \
# 运行时依赖 + 时区 + libpq(psycopg2)
RUN apk add --no-cache tzdata libpq \
&& cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& echo "Asia/Shanghai" > /etc/timezone
@@ -25,4 +25,4 @@ RUN adduser -D -u 1000 app \
COPY --chown=app:app src ./src
USER app
CMD ["python", "-m", "src.main"]
CMD ["uvicorn", "src.api:app", "--host", "0.0.0.0", "--port", "8000"]