version: '3.8' services: bot: build: . container_name: digital-store-bot restart: unless-stopped user: "0:0" # Run as root to avoid permission issues environment: - ENVIRONMENT=production env_file: - .env volumes: - ./data:/app/data - ./logs:/app/logs - ./config:/app/config ports: - "8000:8000" depends_on: - redis healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8000/api/webhooks/health"] interval: 30s timeout: 10s retries: 3 start_period: 40s redis: image: redis:7-alpine container_name: digital-store-redis restart: unless-stopped command: redis-server --appendonly yes --maxmemory 128mb --maxmemory-policy allkeys-lru volumes: - redis_data:/data ports: - "6380:6379" healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 30s timeout: 10s retries: 3 # Optional: Nginx reverse proxy nginx: image: nginx:alpine container_name: digital-store-nginx restart: unless-stopped ports: - "80:80" - "443:443" volumes: - ./nginx.conf:/etc/nginx/nginx.conf:ro - ./ssl:/etc/nginx/ssl:ro depends_on: - bot profiles: - nginx # Optional: Database backup service backup: image: alpine:latest container_name: digital-store-backup restart: "no" volumes: - ./data:/app/data:ro - ./backups:/app/backups environment: - BACKUP_RETENTION_DAYS=30 command: | sh -c ' apk add --no-cache sqlite mkdir -p /app/backups timestamp=$$(date +%Y%m%d_%H%M%S) if [ -f /app/data/store.db ]; then sqlite3 /app/data/store.db ".backup /app/backups/store_backup_$$timestamp.db" echo "Backup created: store_backup_$$timestamp.db" find /app/backups -name "store_backup_*.db" -mtime +$$BACKUP_RETENTION_DAYS -delete fi ' profiles: - backup volumes: redis_data: driver: local networks: default: name: digital-store-network