- Added COPY tests ./tests - Added COPY tests/e2e ./tests/e2e - Required by Cargo workspace manifest (members list includes tests/ and tests/e2e) Wave 125 Phase 3B - Complete workspace test directory addition
141 lines
4.0 KiB
Docker
141 lines
4.0 KiB
Docker
# =============================================================================
|
|
# FOXHUNT ML TRAINING SERVICE - DEVELOPMENT CONTAINER
|
|
# =============================================================================
|
|
# This Dockerfile creates a development container with ML development tools
|
|
# and model experimentation capabilities
|
|
|
|
# =============================================================================
|
|
# BUILDER STAGE - Development Build
|
|
# =============================================================================
|
|
FROM rust:1.75-slim as ml-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 \
|
|
libblas-dev \
|
|
liblapack-dev \
|
|
git \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Development Cargo configuration
|
|
ENV CARGO_NET_GIT_FETCH_WITH_CLI=true
|
|
ENV CARGO_INCREMENTAL=1
|
|
ENV CARGO_PROFILE_DEV_DEBUG=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/ml_training_service ./services/ml_training_service
|
|
|
|
# Build in development mode
|
|
RUN cargo build \
|
|
--package ml_training_service \
|
|
--features minimal
|
|
|
|
# =============================================================================
|
|
# DEVELOPMENT RUNTIME - Ubuntu with ML Tools
|
|
# =============================================================================
|
|
FROM ubuntu:22.04-slim
|
|
|
|
# Install runtime dependencies and ML development tools
|
|
RUN apt-get update && apt-get install -y \
|
|
ca-certificates \
|
|
libssl3 \
|
|
libpq5 \
|
|
curl \
|
|
wget \
|
|
netcat-openbsd \
|
|
# Mathematical libraries
|
|
libblas3 \
|
|
liblapack3 \
|
|
# Python ML ecosystem
|
|
python3 \
|
|
python3-pip \
|
|
python3-dev \
|
|
# Development tools
|
|
git \
|
|
vim \
|
|
htop \
|
|
# AWS CLI for S3 operations
|
|
awscli \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Install Python ML packages for experimentation
|
|
RUN pip3 install \
|
|
numpy \
|
|
pandas \
|
|
matplotlib \
|
|
seaborn \
|
|
jupyter \
|
|
plotly \
|
|
scikit-learn \
|
|
tensorboard \
|
|
mlflow \
|
|
wandb \
|
|
&& rm -rf /root/.cache/pip
|
|
|
|
# Create app user and directories
|
|
RUN groupadd -r foxhunt && useradd -r -g foxhunt -s /bin/bash foxhunt
|
|
RUN mkdir -p /app/config /app/models /app/data /app/checkpoints /app/cache /app/logs \
|
|
/app/experiments /app/notebooks \
|
|
&& chown -R foxhunt:foxhunt /app
|
|
|
|
# Copy debug binary from builder
|
|
COPY --from=ml-dev-builder /workspace/target/debug/ml_training_service /app/ml_training_service
|
|
RUN chmod +x /app/ml_training_service
|
|
|
|
# Copy configuration templates
|
|
COPY services/ml_training_service/config/ /app/config/ || true
|
|
|
|
USER foxhunt
|
|
WORKDIR /app
|
|
|
|
# Expose ports for service, health check, TensorBoard, and Jupyter
|
|
EXPOSE 50053 8083 6006 8888
|
|
|
|
# Development environment variables
|
|
ENV RUST_LOG=debug
|
|
ENV RUST_BACKTRACE=full
|
|
ENV FOXHUNT_CONFIG=/app/config/development.toml
|
|
ENV FOXHUNT_ENV=development
|
|
ENV MODEL_CACHE_DIR=/app/cache
|
|
ENV JUPYTER_ENABLE_LAB=yes
|
|
ENV WANDB_MODE=disabled
|
|
|
|
# Health check for development
|
|
HEALTHCHECK --interval=30s --timeout=15s --start-period=60s --retries=3 \
|
|
CMD curl -f http://localhost:8083/health || exit 1
|
|
|
|
# Development startup
|
|
CMD ["./ml_training_service"] |