Fundamental_Analysis/services/config-service-rs/Dockerfile
Lv, Qi 5327e76aaa chore: 提交本轮 Rust 架构迁移相关改动
- docker-compose: 下线 Python backend/config-service,切换至 config-service-rs
- archive: 归档 legacy Python 目录至 archive/python/*
- services: 新增/更新 common-contracts、api-gateway、各 provider、report-generator-service、config-service-rs
- data-persistence-service: API/system 模块与模型/DTO 调整
- frontend: 更新 useApi 与 API 路由
- docs: 更新路线图并勾选光荣退役
- cleanup: 移除 data-distance-service 占位测试
2025-11-16 20:55:46 +08:00

34 lines
1.1 KiB
Docker

# 1. Build Stage
FROM rust:1.78 as builder
WORKDIR /usr/src/app
# Pre-build dependencies to leverage Docker layer caching
COPY ./services/config-service-rs/Cargo.toml ./services/config-service-rs/Cargo.lock* ./services/config-service-rs/
RUN mkdir -p ./services/config-service-rs/src && \
echo "fn main() {}" > ./services/config-service-rs/src/main.rs && \
cargo build --release --bin config-service-rs
# Copy the full source code
COPY ./services/config-service-rs /usr/src/app/services/config-service-rs
COPY ./config /usr/src/app/config
# Build the application
RUN cargo build --release --bin config-service-rs
# 2. Runtime Stage
FROM debian:bookworm-slim
WORKDIR /app
# Set timezone
ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# Copy the built binary and the config directory from the builder stage
COPY --from=builder /usr/src/app/target/release/config-service-rs /usr/local/bin/
COPY --from=builder /usr/src/app/config ./config
# Set the binary as the entrypoint
ENTRYPOINT ["/usr/local/bin/config-service-rs"]