#!/bin/sh
set -e

# Ensure uploads dir exists; try to chown but ignore failures (some platforms forbid chown)
if [ -d /app/uploads ]; then
  chown -R 1000:1000 /app/uploads >/dev/null 2>&1 || true
else
  mkdir -p /app/uploads >/dev/null 2>&1 || true
  chown -R 1000:1000 /app/uploads >/dev/null 2>&1 || true
fi

# Execute the passed command (do not attempt to change user/groups here)
exec "$@"
