- Rust 1.75 (Nov 2023) too old for base64ct-1.8.0 dependency - base64ct requires edition2024 features not in Cargo 1.75 - Local system uses Rust 1.89, need Docker parity - Updated all 6 Dockerfile variants across 3 services Fixes: - ML training service Docker build - Trading service Docker build - Backtesting service Docker build Related: Wave 125 Phase 3B Docker deployment
116 lines
3.6 KiB
Docker
116 lines
3.6 KiB
Docker
# =============================================================================
|
|
# FOXHUNT TRADING SERVICE - DEVELOPMENT CONTAINER
|
|
# =============================================================================
|
|
# This Dockerfile creates a development-friendly container with debugging
|
|
# capabilities, fast rebuild times, and comprehensive tooling
|
|
|
|
# =============================================================================
|
|
# BUILDER STAGE - Development Build with Debug Symbols
|
|
# =============================================================================
|
|
FROM rust:1.83-slim as trading-dev-builder
|
|
|
|
# Install build dependencies
|
|
RUN apt-get update && apt-get install -y \
|
|
build-essential \
|
|
pkg-config \
|
|
libssl-dev \
|
|
ca-certificates \
|
|
libpq-dev \
|
|
protobuf-compiler \
|
|
git \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Development Cargo configuration (faster builds, debug symbols)
|
|
ENV CARGO_NET_GIT_FETCH_WITH_CLI=true
|
|
ENV CARGO_INCREMENTAL=1
|
|
ENV CARGO_PROFILE_DEV_DEBUG=true
|
|
ENV CARGO_PROFILE_DEV_DEBUG_ASSERTIONS=true
|
|
ENV CARGO_PROFILE_DEV_OVERFLOW_CHECKS=true
|
|
|
|
WORKDIR /workspace
|
|
|
|
# Copy workspace files
|
|
COPY Cargo.toml Cargo.lock ./
|
|
COPY trading_engine ./trading_engine
|
|
COPY risk ./risk
|
|
COPY ml ./ml
|
|
COPY data ./data
|
|
COPY risk-data ./risk-data
|
|
COPY trading-data ./trading-data
|
|
COPY ml-data ./ml-data
|
|
COPY tli ./tli
|
|
COPY backtesting ./backtesting
|
|
COPY adaptive-strategy ./adaptive-strategy
|
|
COPY market-data ./market-data
|
|
COPY database ./database
|
|
COPY common ./common
|
|
COPY storage ./storage
|
|
COPY config ./config
|
|
COPY model_loader ./model_loader
|
|
COPY services/trading_service ./services/trading_service
|
|
COPY services/ml_training_service ./services/ml_training_service
|
|
COPY services/api_gateway ./services/api_gateway
|
|
COPY services/load_tests ./services/load_tests
|
|
COPY services/stress_tests ./services/stress_tests
|
|
COPY services/integration_tests ./services/integration_tests
|
|
COPY services/backtesting_service ./services/backtesting_service
|
|
COPY tests ./tests
|
|
COPY tests/e2e ./tests/e2e
|
|
COPY services/trading_service ./services/trading_service
|
|
|
|
# Build in development mode with all features
|
|
RUN cargo build \
|
|
--package trading_service \
|
|
--features minimal
|
|
|
|
# =============================================================================
|
|
# DEVELOPMENT RUNTIME - Ubuntu with Debug Tools
|
|
# =============================================================================
|
|
FROM ubuntu:22.04-slim
|
|
|
|
# Install runtime dependencies and debug tools
|
|
RUN apt-get update && apt-get install -y \
|
|
ca-certificates \
|
|
libssl3 \
|
|
libpq5 \
|
|
curl \
|
|
wget \
|
|
netcat-openbsd \
|
|
tcpdump \
|
|
strace \
|
|
gdb \
|
|
valgrind \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Create app user
|
|
RUN groupadd -r foxhunt && useradd -r -g foxhunt -s /bin/bash foxhunt
|
|
|
|
# Create directories with proper permissions
|
|
RUN mkdir -p /app/config /app/data /app/logs /app/debug \
|
|
&& chown -R foxhunt:foxhunt /app
|
|
|
|
# Copy debug binary from builder
|
|
COPY --from=trading-dev-builder /workspace/target/debug/trading_service /app/trading_service
|
|
RUN chmod +x /app/trading_service
|
|
|
|
# Copy configuration templates
|
|
COPY services/trading_service/config/ /app/config/
|
|
|
|
USER foxhunt
|
|
WORKDIR /app
|
|
|
|
# Expose ports for gRPC and health/debug endpoints
|
|
EXPOSE 50051 8081 9001
|
|
|
|
# Development environment variables
|
|
ENV RUST_LOG=debug
|
|
ENV RUST_BACKTRACE=full
|
|
ENV FOXHUNT_CONFIG=/app/config/development.toml
|
|
ENV FOXHUNT_ENV=development
|
|
|
|
# Health check for development
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
|
|
CMD curl -f http://localhost:8081/health || exit 1
|
|
|
|
# Development startup script
|
|
CMD ["./trading_service"] |