services:
  mysql:
    volumes:
      - ./client-create-db.sql:/docker-entrypoint-initdb.d/02-client-create-db.sql

  wikibase:
    volumes:
      - ./repo-LocalSettings.php:/var/www/html/LocalSettings.d/20_Wikibase.php
      - ./repo-extra-install.sh:/extra-install.sh

  wikibase-client:
    image: wikibase/wikibase
    depends_on:
      mysql:
        condition: service_healthy
    restart: always
    volumes:
      - wikibase-client-config:/config
      - ./client-LocalSettings.php:/var/www/html/LocalSettings.d/20_Wikibase.php
      - ./empty.php:/var/www/html/LocalSettings.d/30_WikibaseCirrusSearch.php
      - ./empty.php:/var/www/html/LocalSettings.d/30_WikibaseLocalMedia.php
      - ./empty.php:/var/www/html/LocalSettings.d/30_WikibaseEdtf.php
      - ./empty.php:/var/www/html/LocalSettings.d/40_CirrusSearch.php
      - ./empty.php:/var/www/html/LocalSettings.d/40_EntitySchema.php
      - ./empty.php:/var/www/html/LocalSettings.d/40_Elastic.php
      - ./client-extra-install.sh:/extra-install.sh
      - ../${OUTPUT_DIR}:/var/log/mediawiki
    ports:
      - 8383:80
    environment:
      MW_ADMIN_NAME:
      MW_ADMIN_PASS:
      MW_ADMIN_EMAIL:
      MW_WG_SERVER: http://wikibase-client
      DB_SERVER: mysql:3306
      DB_USER:
      DB_PASS:
      DB_NAME: client_wiki
    healthcheck:
      test: curl --silent --fail http://localhost/wiki/Main_Page
      interval: 10s
      start_period: 2m

volumes:
  wikibase-client-config:
