major-domo-v2/docker-compose.dev.yml
Cal Corum 5924249481 CLAUDE: Add comprehensive Docker deployment infrastructure
Implements production-ready Docker setup with multi-stage builds and
separate development/production configurations.

New Files:
- Dockerfile: Multi-stage build with Python 3.13
  * Builder stage: Compiles dependencies with build tools
  * Runtime stage: Minimal image (~150-200MB) with non-root user
  * Health checks and security hardening
- docker-compose.yml: Production config (pulls from Docker Hub)
  * Image: manticorum67/major-domo-discordapp:latest
  * Resource limits: 512MB RAM, 1 CPU
  * Volumes: /app/data (ro), /app/logs (rw)
- docker-compose.dev.yml: Development config (builds locally)
  * Higher resource limits: 1GB RAM, 2 CPU
  * DEBUG log level by default
- .dockerignore: Excludes unnecessary files from build context
- build-and-push.sh: Interactive build/push script for Docker Hub
- DOCKER.md: Comprehensive deployment guide (13K)
- BUILD_AND_PUSH.md: Docker Hub build/push guide (7.7K)

Configuration Updates:
- config.py: Updated sheets_credentials_path to /app/data location
- requirements.txt: Pinned all package versions for reproducibility
- .env.example: Added Docker-specific configuration

Key Features:
- Multi-stage build for optimized image size
- Non-root user (botuser, UID 1000) for security
- Separate dev/prod compose files
- Volume mounts for persistence (/app/data, /app/logs)
- Health checks and automatic restarts
- Resource limits and log rotation
- Docker Hub integration for production deployments

Docker Hub Repository: manticorum67/major-domo-discordapp

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-16 00:54:56 -05:00

79 lines
1.9 KiB
YAML

version: '3.8'
# ============================================
# Development Configuration
# ============================================
# This compose file builds the image locally from source
#
# Usage:
# docker-compose -f docker-compose.dev.yml build
# docker-compose -f docker-compose.dev.yml up -d
services:
discord-bot:
build:
context: .
dockerfile: Dockerfile
image: major-domo/discord-bot-v2:dev
container_name: major-domo-discord-bot-v2-dev
# Restart policy
restart: unless-stopped
# Environment variables from .env file
env_file:
- .env
# Development environment overrides
environment:
- LOG_LEVEL=${LOG_LEVEL:-DEBUG}
- ENVIRONMENT=development
- TESTING=${TESTING:-false}
- REDIS_URL=${REDIS_URL:-}
- REDIS_CACHE_TTL=${REDIS_CACHE_TTL:-300}
# Volume mounts
volumes:
# Google Sheets credentials (required)
- ${SHEETS_CREDENTIALS_HOST_PATH:-./data}:/app/data:ro
# Logs directory (persistent) - mounted to /app/logs where the application expects it
- ${LOGS_HOST_PATH:-./logs}:/app/logs:rw
# Optional: Mount source code for live development
# Uncomment to enable hot-reloading (requires code changes to handle)
# - .:/app:ro
# Network configuration
networks:
- major-domo-network
# Health check
healthcheck:
test: ["CMD", "python", "-c", "import sys; sys.exit(0)"]
interval: 60s
timeout: 10s
start_period: 30s
retries: 3
# Resource limits (development - more generous)
deploy:
resources:
limits:
cpus: '2.0'
memory: 1G
reservations:
cpus: '0.25'
memory: 256M
# Logging configuration
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
networks:
major-domo-network:
driver: bridge