100 lines
2.3 KiB
YAML
100 lines
2.3 KiB
YAML
version: '3.8'
|
|
|
|
services:
|
|
aitrade:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
image: aitrade:local
|
|
container_name: aitrade
|
|
restart: unless-stopped
|
|
|
|
# Note: Distroless runs as UID 65532 (nonroot)
|
|
# Ensure data directory has correct permissions
|
|
user: "65532:65532"
|
|
|
|
# Environment variables (override with .env file)
|
|
environment:
|
|
# Trading Strategy
|
|
TRADING_STRATEGY: normal
|
|
DRY_RUN: "true"
|
|
DRY_RUN_BALANCE: "100000.0"
|
|
TRADING_ENABLED: "false"
|
|
|
|
# Rate Limiting
|
|
MAX_TRADES_PER_HOUR: "6"
|
|
MAX_PARALLEL_TRADES: "5"
|
|
PENDING_TIME_SECONDS: "300"
|
|
|
|
# Database (inside container)
|
|
DB_PATH: /app/data/aitrade.db
|
|
|
|
# Web Server
|
|
WEB_PORT: "8080"
|
|
WEB_HOST: "0.0.0.0"
|
|
|
|
# IB Gateway (host network access)
|
|
IB_GATEWAY_HOST: host.docker.internal
|
|
IB_GATEWAY_PORT: "4001"
|
|
|
|
# News
|
|
NEWS_POLL_INTERVAL: "300"
|
|
|
|
# LLM Scorer (optional - requires Ollama on host)
|
|
LLM_SCORER_ENABLED: "false"
|
|
LLM_SCORER_ENDPOINT: http://host.docker.internal:11434
|
|
LLM_SCORER_MODEL: mistral
|
|
LLM_SCORER_TIMEOUT_SECONDS: "30"
|
|
LLM_SCORER_TEMPERATURE: "0.3"
|
|
LLM_SCORER_ENSEMBLE_WEIGHT: "0.7"
|
|
|
|
# Logging
|
|
LOG_LEVEL: info
|
|
|
|
ports:
|
|
- "8080:8080"
|
|
|
|
volumes:
|
|
# Persistent database
|
|
- ./data:/app/data
|
|
# Optional: Mount config file
|
|
# - ./config.yaml:/app/config.yaml:ro
|
|
|
|
# Note: data directory needs correct permissions for distroless nonroot user
|
|
# Run: mkdir -p data && chown 65532:65532 data
|
|
|
|
# Add host.docker.internal for IB Gateway and Ollama access
|
|
extra_hosts:
|
|
- "host.docker.internal:host-gateway"
|
|
|
|
# Health check using built-in healthcheck binary
|
|
healthcheck:
|
|
test: ["/app/healthcheck", "localhost", "8080"]
|
|
interval: 30s
|
|
timeout: 3s
|
|
retries: 3
|
|
start_period: 10s
|
|
|
|
# Optional: Run Ollama in Docker
|
|
ollama:
|
|
image: ollama/ollama:latest
|
|
container_name: ollama
|
|
restart: unless-stopped
|
|
profiles:
|
|
- llm
|
|
ports:
|
|
- "11434:11434"
|
|
volumes:
|
|
- ollama_data:/root/.ollama
|
|
# Uncomment for GPU support
|
|
# deploy:
|
|
# resources:
|
|
# reservations:
|
|
# devices:
|
|
# - driver: nvidia
|
|
# count: 1
|
|
# capabilities: [gpu]
|
|
|
|
volumes:
|
|
ollama_data:
|