services:
  {% if database.value == "PostgreSQL" %}
  postgres:
    image: {{ db_config.docker_image }}
    container_name: {{ project_slug }}_postgres_dev_db
    environment:
      POSTGRES_DB: mydb
      POSTGRES_USER: myuser
      POSTGRES_PASSWORD: mypassword
    volumes:
      - {{ project_slug }}_postgres_dev_db:/var/lib/postgresql/data
    ports:
      - "5432:5432"
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U myuser -d mydb"]
      interval: 10s
      timeout: 5s
      retries: 5
    restart: unless-stopped

volumes:
  {{ project_slug }}_postgres_dev_db: {}
  {% elif database.value == "MySQL" %}
  mysql:
    image: {{ db_config.docker_image }}
    container_name: {{ project_slug }}_mysql_dev_db
    environment:
      MYSQL_DATABASE: mydb
      MYSQL_USER: myuser
      MYSQL_PASSWORD: mypassword
      MYSQL_ROOT_PASSWORD: rootpassword
    volumes:
      - {{ project_slug }}_mysql_dev_db:/var/lib/mysql
    ports:
      - "3306:3306"
    healthcheck:
      test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
      interval: 10s
      timeout: 5s
      retries: 5
    restart: unless-stopped

volumes:
  {{ project_slug }}_mysql_dev_db: {}
  {% endif %}
  {% if memory_store.value == "Redis" %}
  redis:
    image: {{ store_config.docker_image }}
    container_name: {{ project_slug }}_redis_dev
    ports:
      - "{{ store_config.port }}:6379"
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 10s
      timeout: 5s
      retries: 5
    restart: unless-stopped
  {% elif memory_store.value == "Valkey" %}
  valkey:
    image: {{ store_config.docker_image }}
    container_name: {{ project_slug }}_valkey_dev
    ports:
      - "{{ store_config.port }}:6379"
    healthcheck:
      test: ["CMD", "valkey-cli", "ping"]
      interval: 10s
      timeout: 5s
      retries: 5
    restart: unless-stopped
  {% endif %}
