#!/usr/bin/env bash

set -euo pipefail

ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
LOG_DIR="${ROOT_DIR}/logs"
LOG_FILE="${LOG_DIR}/docker-compose.log"

mkdir -p "${LOG_DIR}"

echo "Writing docker compose output to ${LOG_FILE}"
echo "Started at $(date -u +"%Y-%m-%dT%H:%M:%SZ")" >> "${LOG_FILE}"

cd "${ROOT_DIR}"
docker compose up --build "$@" 2>&1 | tee -a "${LOG_FILE}"
