前端: 新增 RealTimeQuoteResponse 类型;新增 useRealtimeQuote Hook 并在报告页图表旁展示价格与时间戳(严格 TTL,无兜底)
FastAPI: 新增 GET /financials/{market}/{symbol}/realtime?max_age_seconds=.. 只读端点;通过 DataPersistenceClient 读取 Rust 缓存
Rust: 新增 realtime_quotes hypertable 迁移;新增 POST /api/v1/market-data/quotes 与 GET /api/v1/market-data/quotes/{symbol}?market=..;新增 DTO/Model/DB 函数;修正 #[api] 宏与路径参数;生成 SQLx 离线缓存 (.sqlx) 以支持离线构建
Python: DataPersistenceClient 新增 upsert/get 实时报价,并调整 GET 路径与参数
说明: TradingView 图表是第三方 websocket,不受我们缓存控制;页面数值展示走自有缓存通路,统一且可控。
31 lines
1.1 KiB
Docker
31 lines
1.1 KiB
Docker
# Stage 1: Build the application in a build environment
|
|
# We use cargo-chef to cache dependencies and speed up future builds
|
|
FROM rust:1.78-slim AS chef
|
|
WORKDIR /app
|
|
RUN cargo install cargo-chef
|
|
|
|
FROM chef AS planner
|
|
COPY . .
|
|
# Compute a lock file for dependencies
|
|
RUN cargo chef prepare --recipe-path recipe.json
|
|
|
|
FROM chef AS builder
|
|
COPY --from=planner /app/recipe.json recipe.json
|
|
# Build dependencies first, this layer will be cached if dependencies don't change
|
|
RUN cargo chef cook --release --recipe-path recipe.json
|
|
# Copy application code and build the application
|
|
COPY . .
|
|
RUN cargo build --release --bin data-persistence-service
|
|
|
|
# Stage 2: Create the final, minimal production image
|
|
FROM debian:bookworm-slim AS runtime
|
|
WORKDIR /app
|
|
# Copy the compiled binary from the builder stage
|
|
COPY --from=builder /app/target/release/data-persistence-service /usr/local/bin/
|
|
# Copy migrations for `sqlx-cli` if needed at runtime
|
|
COPY ./migrations ./migrations
|
|
# Expose the port the application will listen on
|
|
EXPOSE 8080
|
|
# Set the entrypoint for the container
|
|
ENTRYPOINT ["/usr/local/bin/data-persistence-service"]
|