version: '3.8' services: # PostgreSQL Database postgres: image: postgres:15-alpine container_name: motm-postgres environment: POSTGRES_DB: motm_db POSTGRES_USER: motm_user POSTGRES_PASSWORD: motm_password volumes: - postgres_data:/var/lib/postgresql/data - ./init.sql:/docker-entrypoint-initdb.d/init.sql:ro ports: - "5432:5432" healthcheck: test: ["CMD-SHELL", "pg_isready -U motm_user -d motm_db"] interval: 10s timeout: 5s retries: 5 restart: unless-stopped # MOTM Application motm-app: build: context: . dockerfile: Containerfile container_name: motm-app environment: # Database configuration DATABASE_TYPE: postgresql DB_HOST: postgres DB_PORT: 5432 DB_NAME: motm_db DB_USER: motm_user DB_PASSWORD: motm_password # Flask configuration FLASK_ENV: production FLASK_APP: main.py FLASK_RUN_HOST: 0.0.0.0 FLASK_RUN_PORT: 5000 # Security SECRET_KEY: your-secret-key-change-this-in-production ports: - "5000:5000" depends_on: postgres: condition: service_healthy volumes: - ./data:/app/data - ./logs:/app/logs restart: unless-stopped healthcheck: test: ["CMD", "curl", "-f", "http://localhost:5000/"] interval: 30s timeout: 10s retries: 3 start_period: 40s volumes: postgres_data: driver: local networks: default: name: motm-network