trading-algo/Dockerfile
Gal Podlipnik 5f5e182bc2 fixy
2025-07-17 03:20:54 +02:00

36 lines
862 B
Docker

# Trading System Dockerfile
FROM python:3.11-slim
# Set working directory
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
gcc \
g++ \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements first for better caching
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy source code
COPY . .
# Create logs directory
RUN mkdir -p logs
# Create non-root user for security
RUN useradd -m -u 1000 trader && \
chown -R trader:trader /app
USER trader
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD python3 -c "import sys; sys.path.append('src'); from src.data_handler import DataHandler; DataHandler().get_latest_price('ETH/USD')" || exit 1
# Default command
CMD ["python3", "main.py", "--mode", "paper"]