Fundamental_Analysis/services/config-service-rs/Dockerfile
Lv, Qi ceffa0d95c chore(build): unify Dockerfiles and root .dockerignore; fix services after deps upgrade
- secrecy: migrate Secret<String> -> SecretString across services; adjust usages
- warnings: clean unused imports/structs (no behavior change)
- docker-compose: remove unnecessary host port mappings; rely on app-network; keep frontend only
- build: set build.context to repo root; reference per-service Dockerfiles
- add: root .dockerignore to exclude target/node_modules/ref/archive/docs and logs
- data-persistence-service: refine cargo-chef with path deps; slim context; copy correct targets
- Dockerfiles: normalize multi-stage builds; fix WORKDIR and release binary paths
- nats: resolve 4222 conflict by not binding to host
- verified: all rust services build successfully with new flow
2025-11-16 23:34:28 +08:00

36 lines
1.1 KiB
Docker

# 1. Build Stage
FROM rust:1.90 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/
WORKDIR /usr/src/app/services/config-service-rs
RUN mkdir -p src && \
echo "fn main() {}" > 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
WORKDIR /usr/src/app/services/config-service-rs
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/services/config-service-rs/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"]