services:
  postgres:
    image: postgres
    restart: always
    volumes:
      - pgdata_test:/var/lib/postgresql
    environment:
      POSTGRES_USER: strapi
      POSTGRES_PASSWORD: strapi
      POSTGRES_DB: strapi_test
    healthcheck:
      test: ['CMD-SHELL', 'pg_isready']
      interval: 10s
      timeout: 5s
      retries: 5
    ports:
      - '5432:5432'

  mysql:
    image: mysql:8
    restart: always
    environment:
      MYSQL_DATABASE: strapi_test
      MYSQL_USER: strapi
      MYSQL_PASSWORD: strapi
      MYSQL_ROOT_HOST: '%'
      MYSQL_ROOT_PASSWORD: strapi
    volumes:
      - mysqldata_test:/var/lib/mysql
    healthcheck:
      test: ['CMD-SHELL', 'mysqladmin ping']
      interval: 10s
      timeout: 5s
      retries: 3
    ports:
      - '3306:3306'

volumes:
  pgdata_test:
  mysqldata_test:
