name: tira-inmobiliaria

services:
  mariadb:
    image: 'mariadb:10.11'
    container_name: tira-mariadb
    restart: unless-stopped
    ports:
      - '${DB_PORT:-3306}:3306'
    environment:
      MYSQL_ROOT_PASSWORD: '${DB_PASSWORD:-admin}'
      MYSQL_DATABASE: '${DB_DATABASE:-database}'
      MYSQL_ALLOW_EMPTY_PASSWORD: 'no'
    volumes:
      - tira-mariadb-data:/var/lib/mysql
    networks:
      - tira-network
    healthcheck:
      test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
      retries: 3
      timeout: 5s

  phpmyadmin:
    image: 'phpmyadmin:latest'
    container_name: tira-phpmyadmin
    restart: unless-stopped
    ports:
      - '8080:80'
    environment:
      PMA_HOST: mariadb
      PMA_PORT: 3306
      PMA_USER: root
      PMA_PASSWORD: '${DB_PASSWORD:-admin}'
    networks:
      - tira-network
    depends_on:
      mariadb:
        condition: service_healthy

networks:
  tira-network:
    driver: bridge

volumes:
  tira-mariadb-data:
    driver: local
