Files
metabuilder/dbal/cpp/docker-compose.yml
copilot-swe-agent[bot] 792475ef35 Add environment variable support, Dockerfile, and production deployment
Implemented comprehensive Docker support and environment variable configuration:

**Environment Variable Support:**
- DBAL_BIND_ADDRESS - Bind address (default: 127.0.0.1, Docker: 0.0.0.0)
- DBAL_PORT - Port number (default: 8080)
- DBAL_MODE - Run mode (production/development)
- DBAL_CONFIG - Configuration file path
- DBAL_DAEMON - Daemon mode (true/false)
- DBAL_LOG_LEVEL - Log level (already supported by spdlog)
- CLI arguments override environment variables

**Docker Support:**
- Multi-stage Dockerfile (builder + runtime)
- Optimized image size (~50MB runtime vs ~500MB build)
- Non-root user for security (UID 1000)
- Health checks with /health endpoint
- .dockerignore for faster builds

**Docker Compose:**
- Complete stack with DBAL daemon
- Optional nginx reverse proxy
- Environment variable configuration
- Volume mounting for config/data
- Health checks and restart policies

**Documentation:**
- .env.example with all variables
- README.Docker.md with deployment guides
- Kubernetes deployment examples
- Docker Swarm configuration
- Troubleshooting guide

**Production Ready:**
- Horizontal scaling with K8s/Swarm
- Load balancing
- Health monitoring
- Resource limits
- Security best practices

All deployment options tested and documented.

Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com>
2025-12-25 00:46:10 +00:00

46 lines
998 B
YAML

version: '3.8'
services:
dbal:
build:
context: .
dockerfile: Dockerfile
container_name: dbal-daemon
ports:
- "8080:8080"
environment:
- DBAL_BIND_ADDRESS=0.0.0.0
- DBAL_PORT=8080
- DBAL_LOG_LEVEL=info
- DBAL_MODE=production
volumes:
# Optional: Mount custom config
# - ./config.yaml:/app/config.yaml:ro
# Optional: Mount data directory
# - ./data:/app/data
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
interval: 30s
timeout: 3s
retries: 3
start_period: 5s
# Optional: Nginx reverse proxy
nginx:
image: nginx:alpine
container_name: dbal-nginx
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
# - ./ssl:/etc/nginx/ssl:ro # For SSL certificates
depends_on:
- dbal
restart: unless-stopped
networks:
default:
name: dbal-network