Files
trading_bot_v3/v4/docker-compose.dev.yml
mindesbunister 8bb2f64568 feat: Add complete Docker containerization for v4
Production & Development Setup:
- Multi-stage Dockerfile with optimized build (node:20-alpine)
- docker-compose.yml for production with PostgreSQL
- docker-compose.dev.yml for development with hot reload
- Dockerfile.dev for development environment
- .dockerignore to reduce build context

Features:
- Health checks for both app and database
- Non-root user security (nextjs:nodejs)
- Resource limits (CPU/memory)
- Volume persistence for logs and database
- PostgreSQL 16 with automatic initialization
- Network isolation with custom bridge network

Helper Scripts:
- docker-build.sh - Build production image
- docker-start.sh - Start all services
- docker-stop.sh - Stop containers safely
- docker-logs.sh - View real-time logs

Documentation:
- DOCKER.md - Complete deployment guide with:
  * Quick start commands
  * Production deployment steps
  * Development hot reload setup
  * Configuration examples
  * Docker commands reference
  * Troubleshooting guide
  * Best practices for security & performance

Configuration:
- Environment-based configuration via .env
- Safe defaults for testing ($50 positions)
- Separate dev/prod compose files
- Debug mode with Node.js inspector (port 9229)
- Log rotation and resource monitoring

Ready for deployment with:
  cd v4 && ./docker-start.sh
2025-10-23 14:57:49 +02:00

67 lines
1.7 KiB
YAML

# Trading Bot v4 - Development Docker Compose
# Hot reload enabled, debug logging, no database required
version: '3.9'
services:
# ================================
# Trading Bot (Development)
# ================================
trading-bot-dev:
build:
context: ..
dockerfile: v4/Dockerfile.dev
args:
NODE_ENV: development
container_name: trading-bot-v4-dev
restart: unless-stopped
ports:
- "3001:3000" # Use different port to avoid conflicts
- "9229:9229" # Node.js debugger
environment:
NODE_ENV: development
PORT: 3000
LOG_LEVEL: debug
DEBUG: "*"
# Load from .env file
DRIFT_WALLET_PRIVATE_KEY: ${DRIFT_WALLET_PRIVATE_KEY}
DRIFT_ENV: ${DRIFT_ENV:-devnet} # Use devnet by default in development
API_SECRET_KEY: ${API_SECRET_KEY:-dev-secret-key}
SOLANA_RPC_URL: ${SOLANA_RPC_URL}
PYTH_HERMES_URL: ${PYTH_HERMES_URL:-https://hermes.pyth.network}
# Safe defaults for development
MAX_POSITION_SIZE_USD: ${MAX_POSITION_SIZE_USD:-10}
LEVERAGE: ${LEVERAGE:-10}
DRY_RUN: ${DRY_RUN:-true} # Dry run by default in dev
# Notifications (optional in dev)
TELEGRAM_BOT_TOKEN: ${TELEGRAM_BOT_TOKEN:-}
TELEGRAM_CHAT_ID: ${TELEGRAM_CHAT_ID:-}
volumes:
# Hot reload - mount source code
- ..:/app:cached
- /app/node_modules
- /app/.next
# Mount logs
- ./logs:/app/logs
networks:
- trading-net-dev
command: npm run dev
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/api/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
networks:
trading-net-dev:
driver: bridge