Fundamental_Analysis/services/yfinance-provider-service/Dockerfile
Lv, Qi 53d69a00e5 fix(services): make providers observable and robust
- Fix Dockerfile stub builds; compile full sources (no empty binaries)
- Add ca-certificates and curl in runtime images for TLS/healthchecks
- Enable RUST_LOG and RUST_BACKTRACE for all providers
- Add HTTP /health healthchecks in docker-compose for ports 8000-8004
- Standardize Tushare /health to structured HealthStatus JSON
- Enforce strict config validation (FINNHUB_API_KEY, TUSHARE_API_TOKEN)
- Map provider API keys via .env in docker-compose
- Log provider_services at API Gateway startup for diagnostics

Outcome: provider containers no longer exit silently; missing keys fail fast with explicit errors; health and logs are consistent across modules.
2025-11-17 04:40:51 +08:00

25 lines
1.0 KiB
Docker

# 1. Build Stage
FROM rust:1.90 as builder
WORKDIR /usr/src/app
# Copy full sources (simple and correct; avoids shipping stub binaries)
COPY ./services/common-contracts /usr/src/app/services/common-contracts
COPY ./services/yfinance-provider-service /usr/src/app/services/yfinance-provider-service
WORKDIR /usr/src/app/services/yfinance-provider-service
RUN cargo build --release --bin yfinance-provider-service
# 2. Runtime Stage
FROM debian:bookworm-slim
# Set timezone
ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# Minimal runtime deps for health checks (curl) and TLS roots if needed
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates curl && rm -rf /var/lib/apt/lists/*
# Copy the built binary from the builder stage
COPY --from=builder /usr/src/app/services/yfinance-provider-service/target/release/yfinance-provider-service /usr/local/bin/
# Set the binary as the entrypoint
ENTRYPOINT ["/usr/local/bin/yfinance-provider-service"]