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

ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
IMAGE="${FLUTTER_DOCKER_IMAGE:-ghcr.io/cirruslabs/flutter:stable}"

docker run --rm \
  -u 0:0 \
  -v "$ROOT_DIR:/workspace" \
  -w /workspace/app \
  "$IMAGE" \
  sh -lc "flutter pub get && dart format lib test && chown -R 1000:1000 /workspace/app"
