Files
CryptoTrading/Dockerfile
bnair123 6f602c0d19 Add core infrastructure: config, Binance adapter, docs, and auto-setup
- Add Pydantic settings with trading mode validation (paper/testnet/live)
- Implement Binance USDⓈ-M Futures adapter with hedge mode, isolated margin
- Add type definitions for orders, positions, and market data
- Create documentation (PLAN.md, ARCHITECTURE.md, SECURITY.md)
- Add setup.sh with uv/pip auto-detection for consistent dev environments
- Configure Docker multi-stage build and docker-compose services
- Add pyproject.toml with all dependencies and tool configs
2025-12-27 13:28:08 +04:00

70 lines
2.0 KiB
Docker

# TradeFinder Dockerfile
# Multi-stage build for engine and UI targets
# =============================================================================
# BASE IMAGE
# =============================================================================
FROM python:3.11-slim AS base
# System dependencies for TA-Lib and general build
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
wget \
curl \
&& rm -rf /var/lib/apt/lists/*
# Install TA-Lib C library
RUN wget -q http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz \
&& tar -xzf ta-lib-0.4.0-src.tar.gz \
&& cd ta-lib \
&& ./configure --prefix=/usr \
&& make \
&& make install \
&& cd .. \
&& rm -rf ta-lib ta-lib-0.4.0-src.tar.gz
# Set working directory
WORKDIR /app
# Copy project files
COPY pyproject.toml README.md ./
COPY src/ ./src/
# Install Python dependencies
RUN pip install --no-cache-dir --upgrade pip \
&& pip install --no-cache-dir -e ".[dev]"
# =============================================================================
# ENGINE TARGET (trading engine, backtester, optimizer)
# =============================================================================
FROM base AS engine
# Create non-root user for security
RUN useradd --create-home --shell /bin/bash trader
RUN mkdir -p /data && chown -R trader:trader /data /app
USER trader
# Default command
CMD ["python", "-m", "tradefinder.core.main"]
# =============================================================================
# UI TARGET (Streamlit dashboard)
# =============================================================================
FROM base AS ui
# Install additional UI dependencies
RUN pip install --no-cache-dir streamlit plotly
# Create non-root user
RUN useradd --create-home --shell /bin/bash trader
RUN mkdir -p /data && chown -R trader:trader /data /app
USER trader
# Expose Streamlit port
EXPOSE 8501
# Default command
CMD ["streamlit", "run", "src/tradefinder/ui/app.py", "--server.port=8501", "--server.address=0.0.0.0"]