#!/bin/sh
set -eu

# Fix permissions on mounted volumes so the non-root user can write.
# If the volume is root-owned (common on first run), chown it once.
if [ -d /app/data ]; then
  chown -R appuser:appuser /app/data || true
fi
if [ -d /app/mlruns ]; then
  chown -R appuser:appuser /app/mlruns || true
fi

exec gosu appuser "$@"
