services:

  tessera-conformance-mysql-db:
    container_name: tessera-mysql-db
    image: "mysql:8.4"
    ports:
      - "3306:3306"
    environment:
      - MYSQL_ROOT_PASSWORD=tessera
      - MYSQL_DATABASE=tessera
      - MYSQL_USER=tessera
      - MYSQL_PASSWORD=tessera
    restart: always
    healthcheck:
      test: mysql --user=$$MYSQL_USER --password=$$MYSQL_PASSWORD --silent --execute "SHOW DATABASES;"
      interval: 5s
      timeout: 5s
      retries: 10

  tessera-conformance-mysql:
    container_name: tessera-conformance-mysql
    build:
      context: ../../../../
      dockerfile: ./cmd/conformance/mysql/docker/Dockerfile
    ports:
      - "2024:2024"
    command: [
      "--mysql_uri=tessera:tessera@tcp(tessera-conformance-mysql-db:3306)/tessera",
      "--init_schema_path=/schema.sql",
      "--private_key_path=/key",
      "--alsologtostderr",
      "--v=1",
    ]
    restart: always
    depends_on:
      tessera-conformance-mysql-db:
        condition: service_healthy
