version: '3.8'

# Development environment docker-compose configuration
# Usage: docker-compose -f docker-compose.dev.yml up -d

services:
  # MySQL Database Service (Development)
  mysql:
    image: mysql:8.0
    container_name: overseas-appointment-mysql-dev
    restart: unless-stopped
    ports:
      - "3306:3306"
    environment:
      - MYSQL_ROOT_PASSWORD=root_password
      - MYSQL_DATABASE=overseas_appointment
      - MYSQL_USER=app_user
      - MYSQL_PASSWORD=app_password
    command: --default-authentication-plugin=mysql_native_password --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
    volumes:
      - mysql_dev_data:/var/lib/mysql
      - ./docker/mysql/conf.d:/etc/mysql/conf.d
    networks:
      - dev-network
    healthcheck:
      test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-proot_password"]
      interval: 10s
      timeout: 5s
      retries: 5
      start_period: 30s

  # Redis Cache Service (Development)
  redis:
    image: redis:7-alpine
    container_name: overseas-appointment-redis-dev
    restart: unless-stopped
    ports:
      - "6379:6379"
    command: redis-server --appendonly yes
    volumes:
      - redis_dev_data:/data
    networks:
      - dev-network
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 10s
      timeout: 5s
      retries: 5
      start_period: 10s

networks:
  dev-network:
    driver: bridge

volumes:
  mysql_dev_data:
    driver: local
  redis_dev_data:
    driver: local
