#!/usr/bin/env bash
set -euo pipefail

# shellcheck source=../lib/common.sh
source "$(dirname "$0")/../lib/common.sh"
# shellcheck source=../lib/docker.sh
source "$(dirname "$0")/../lib/docker.sh"

cd "$LM_ROOT"
docker_cmd

if ! docker info >/dev/null 2>&1 && ! sudo -n docker info >/dev/null 2>&1; then
  echo "Cần quyền Docker. Thử: sudo $0 hoặc usermod -aG docker \$USER"
fi

"${DOCKER[@]}" compose up --build -d
echo "Đã chạy: http://localhost:8080/"
echo -n "Giới hạn: "
print_container_limits "$LM_CONTAINER"
