# Build stage FROM rust:1.83-bookworm AS builder WORKDIR /app # Copy workspace configuration COPY Cargo.toml Cargo.lock ./ COPY .cargo ./.cargo # Copy all crates (workspace members) COPY common ./common COPY config ./config COPY database ./database COPY ml-data ./ml-data COPY services/trading_agent_service ./services/trading_agent_service # Build trading agent service WORKDIR /app/services/trading_agent_service RUN cargo build --release --bin trading_agent_service # Runtime stage FROM debian:bookworm-slim # Install runtime dependencies RUN apt-get update && apt-get install -y \ ca-certificates \ curl \ && rm -rf /var/lib/apt/lists/* # Install grpc_health_probe for health checks RUN curl -L https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/v0.4.24/grpc_health_probe-linux-amd64 \ -o /usr/local/bin/grpc_health_probe && \ chmod +x /usr/local/bin/grpc_health_probe WORKDIR /app # Copy binary from builder COPY --from=builder /app/target/release/trading_agent_service /usr/local/bin/trading_agent_service # Expose ports EXPOSE 50055 8083 9095 # Run service CMD ["trading_agent_service"]