services:
  mysql:
    image: mysql:8.4
    container_name: treasureseeds-strapi-mysql
    restart: unless-stopped
    ports:
      - "${DATABASE_PORT:-3306}:3306"
    environment:
      MYSQL_DATABASE: "${DATABASE_NAME}"
      MYSQL_USER: "${DATABASE_USERNAME}"
      MYSQL_PASSWORD: "${DATABASE_PASSWORD}"
      MYSQL_ROOT_PASSWORD: "${MYSQL_ROOT_PASSWORD:-local-root-password}"
    command:
      - --character-set-server=utf8mb4
      - --collation-server=utf8mb4_unicode_ci
    volumes:
      - mysql_data:/var/lib/mysql
    healthcheck:
      test:
        - CMD
        - mysqladmin
        - ping
        - -h
        - 127.0.0.1
        - -uroot
        - -p${MYSQL_ROOT_PASSWORD:-local-root-password}
      interval: 10s
      timeout: 5s
      retries: 12
      start_period: 30s

volumes:
  mysql_data:
