version: '3'

services:
  mariadb:
    image: mariadb:latest
    container_name: mariadb
    restart: unless-stopped
    environment:
      - MYSQL_ROOT_PASSWORD=your_secure_root_password
      - MYSQL_DATABASE=homeassistant
      - MYSQL_USER=homeassistant
      - MYSQL_PASSWORD=your_secure_password
    volumes:
      - ./mariadb-data:/var/lib/mysql
    ports:
      - "3306:3306"
    deploy:
      resources:
        limits:
          cpus: '0.5'
          memory: 1G
        reservations:
          cpus: '0.2'
          memory: 512M
    networks:
      - homeassistant_network

networks:
  homeassistant_network:
    driver: bridge
