version: "3.9" networks: konstruct-net: driver: bridge volumes: postgres_data: redis_data: ollama_data: services: postgres: image: postgres:16-alpine container_name: konstruct-postgres environment: POSTGRES_DB: konstruct POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres_dev volumes: - postgres_data:/var/lib/postgresql/data - ./scripts/init-db.sh:/docker-entrypoint-initdb.d/init-db.sh:ro ports: - "5432:5432" networks: - konstruct-net healthcheck: test: ["CMD-SHELL", "pg_isready -U postgres -d konstruct"] interval: 5s timeout: 5s retries: 10 redis: image: redis:7-alpine container_name: konstruct-redis command: redis-server --save 60 1 --loglevel warning volumes: - redis_data:/data ports: - "6379:6379" networks: - konstruct-net healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 5s timeout: 5s retries: 10 ollama: image: ollama/ollama:latest container_name: konstruct-ollama volumes: - ollama_data:/root/.ollama ports: - "11434:11434" networks: - konstruct-net deploy: resources: reservations: devices: - driver: nvidia count: all capabilities: [gpu] # Service starts even if no GPU is available — GPU config is optional restart: unless-stopped