version: '3.8' services: postgres: image: postgres:16-alpine container_name: chatbot-postgres environment: POSTGRES_DB: ${DB_NAME:-chatbot} POSTGRES_USER: ${DB_USER:-postgres} POSTGRES_PASSWORD: ${DB_PASSWORD:-postgres} ports: - "${DB_PORT:-5432}:5432" volumes: - postgres_data:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-postgres}"] interval: 10s timeout: 5s retries: 5 networks: - chatbot-network chatbot: build: context: ./ChatBot dockerfile: Dockerfile container_name: chatbot-app depends_on: postgres: condition: service_healthy environment: - DB_HOST=postgres - DB_PORT=5432 - DB_NAME=${DB_NAME:-chatbot} - DB_USER=${DB_USER:-postgres} - DB_PASSWORD=${DB_PASSWORD:-postgres} - TELEGRAM_BOT_TOKEN=${TELEGRAM_BOT_TOKEN} - OLLAMA_URL=${OLLAMA_URL} - OLLAMA_DEFAULT_MODEL=${OLLAMA_DEFAULT_MODEL:-gemma3:4b} volumes: - ./ChatBot/logs:/app/logs restart: unless-stopped networks: - chatbot-network healthcheck: test: ["CMD", "dotnet", "ChatBot.dll", "--health-check"] interval: 30s timeout: 10s retries: 3 start_period: 40s volumes: postgres_data: driver: local networks: chatbot-network: driver: bridge