# ============================================================================= # FOXHUNT TLI CLIENT - LIGHTWEIGHT PRODUCTION CONTAINER # ============================================================================= # This Dockerfile creates a lightweight container for the TLI client # optimized for deployment in containerized environments # ============================================================================= # BUILDER STAGE - TLI Build # ============================================================================= FROM rust:1.75-slim as tli-builder # Install build dependencies RUN apt-get update && apt-get install -y \ build-essential \ pkg-config \ libssl-dev \ ca-certificates \ protobuf-compiler \ && rm -rf /var/lib/apt/lists/* # Production Cargo configuration ENV CARGO_NET_GIT_FETCH_WITH_CLI=true ENV CARGO_INCREMENTAL=0 ENV CARGO_PROFILE_RELEASE_LTO=true ENV CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1 ENV CARGO_PROFILE_RELEASE_OPT_LEVEL=3 ENV CARGO_PROFILE_RELEASE_DEBUG=false ENV CARGO_PROFILE_RELEASE_STRIP=true WORKDIR /workspace # Copy workspace files for TLI COPY Cargo.toml Cargo.lock ./ COPY trading_engine ./trading_engine COPY common ./common COPY tli ./tli # Build TLI client (pure client, no business logic dependencies) RUN cargo build \ --release \ --package tli # ============================================================================= # LIGHTWEIGHT RUNTIME - Alpine for Minimal Size # ============================================================================= FROM alpine:3.19 # Install minimal runtime dependencies RUN apk add --no-cache \ ca-certificates \ libssl3 \ # Terminal support ncurses \ ncurses-terminfo \ bash \ curl # Create app user RUN addgroup -g 1001 foxhunt && adduser -D -s /bin/bash -u 1001 -G foxhunt foxhunt # Create directories RUN mkdir -p /app/config /app/logs \ && chown -R foxhunt:foxhunt /app # Copy binary from builder COPY --from=tli-builder /workspace/target/release/tli /app/tli RUN chmod +x /app/tli # Copy configuration templates COPY tli/config/ /app/config/ || true USER foxhunt WORKDIR /app # Terminal environment ENV TERM=xterm-256color ENV COLORTERM=truecolor # TLI environment variables ENV RUST_LOG=info ENV FOXHUNT_CONFIG=/app/config/production.toml # No health check for client application # No exposed ports for client application # Interactive shell by default for terminal access CMD ["/bin/bash"]