services:
  invoiceplane:
    build: .
    image: funktionslust/invoiceplane:latest
    container_name: invoiceplane
    restart: unless-stopped
    ports:
      - "8085:80"
    environment:
      - TZ=UTC
      - IP_DB_HOSTNAME=mariadb
      - IP_DB_DATABASE=invoiceplane
      - IP_DB_USERNAME=invoiceplane
      - IP_DB_PASSWORD=change_this_password
      - PROXY_NETWORKS=172.16.0.0/12 10.0.0.0/8
      - INSTALL_EINVOICE_TEMPLATES=zugferdv23extended
      - IP_URL=http://<host ip address>:8085
      - ENABLE_INVOICE_DELETION=true
      - DISABLE_READ_ONLY=true
    volumes:
      - invoiceplane_uploads:/var/www/html/uploads
      - invoiceplane_logs:/var/www/html/application/logs
    depends_on:
      mariadb:
        condition: service_healthy

  mariadb:
    image: mariadb:11.6
    container_name: invoiceplane-db
    restart: unless-stopped
    environment:
      - MYSQL_ROOT_PASSWORD=change_this_root_password
      - MYSQL_DATABASE=invoiceplane
      - MYSQL_USER=invoiceplane
      - MYSQL_PASSWORD=change_this_password
    volumes:
      - mariadb_data:/var/lib/mysql
    healthcheck:
      test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
      interval: 10s
      timeout: 5s
      retries: 5

volumes:
  invoiceplane_uploads:
  invoiceplane_logs:
  mariadb_data:
