version: '3.8' services: backend: build: context: . dockerfile: Dockerfile container_name: privacy-gateway-backend restart: unless-stopped ports: - "${PORT:-3000}:3000" environment: - NODE_ENV=${NODE_ENV:-production} - PORT=3000 - DB_HOST=postgres - DB_PORT=5432 - DB_NAME=${DB_NAME:-privacy_gateway} - DB_USER=${DB_USER:-postgres} - DB_PASSWORD=${DB_PASSWORD} - REDIS_HOST=redis - REDIS_PORT=6379 - OLLAMA_HOST=${OLLAMA_HOST:-anonymizer} - OLLAMA_PORT=${OLLAMA_PORT:-11434} - OLLAMA_TARGET_HOST=${OLLAMA_TARGET_HOST:-ollama} - OLLAMA_TARGET_PORT=${OLLAMA_TARGET_PORT:-11434} - ANONYMIZATION_MODEL=${ANONYMIZATION_MODEL:-llama3.2} - CHAT_MODEL=${CHAT_MODEL:-llama3.2} - LOG_LEVEL=${LOG_LEVEL:-info} depends_on: postgres: condition: service_healthy redis: condition: service_healthy anonymizer: condition: service_started networks: - privacy-gateway healthcheck: test: ["CMD", "wget", "--spider", "-q", "http://localhost:3000/health"] interval: 30s timeout: 5s retries: 3 start_period: 10s postgres: image: postgres:16-alpine container_name: privacy-gateway-postgres restart: unless-stopped environment: - POSTGRES_DB=${DB_NAME:-privacy_gateway} - POSTGRES_USER=${DB_USER:-postgres} - POSTGRES_PASSWORD=${DB_PASSWORD} volumes: - postgres_data:/var/lib/postgresql/data networks: - privacy-gateway healthcheck: test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-postgres}"] interval: 5s timeout: 5s retries: 5 redis: image: redis:7-alpine container_name: privacy-gateway-redis restart: unless-stopped volumes: - redis_data:/data networks: - privacy-gateway healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 5s timeout: 3s retries: 5 anonymizer: image: ollama/ollama:latest container_name: privacy-gateway-anonymizer restart: unless-stopped environment: - OLLAMA_HOST=0.0.0.0 - OLLAMA_PORT=11434 volumes: - anonymizer_models:/root/.ollama networks: - privacy-gateway # Remove GPU access for broader compatibility command: serve volumes: postgres_data: redis_data: anonymizer_models: networks: privacy-gateway: driver: bridge