services:
  apache:
    build: .
    container_name: translucid-app
    networks:
      - translucidNet
#      - postfixNet
    volumes:
      - translucid:/var/www/html        
    depends_on:
      - db
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.translucid.rule=Host(`translucid.kazkouil.fr`)"
      - "traefik.docker.network=translucidNet"
  db:
    image: mariadb:11.6
    container_name: translucid-DB
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
    restart: ${restartPolicy}
    volumes:
      - ./initdb.d:/docker-entrypoint-initdb.d:ro
      - translucidDB:/var/lib/mysql
      - /etc/localtime:/etc/localtime:ro
      - /etc/timezone:/etc/timezone:ro
    env_file:
      - ../../secret/env-wpDB
    networks:
      - translucidNet
    healthcheck: # utilisé par init-db.sh pour la créa d'orga
      test: ["CMD", 'healthcheck.sh', '--su-mysql', '--connect', '--innodb_initialized']                      
      interval: 30s
      timeout: 30s
      retries: 5

volumes:
  translucid:
  translucidDB:

networks:
  translucidNet:
    external: true
    name: translucidNet
#  postfixNet:
#    external: true
#    name: postfixNet
