# Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE
#
# Mario's container: Mini Me (mm) v1.0.3 and the tools its bash tool needs.
# The image only holds the program; the agent's folder is mounted by
# compose.yaml at the same path as on the Mac, and Sidekicks starts mm in it
# with `docker exec -i mario-box mm --acp --config …/agent.yaml`.

FROM debian:bookworm-slim

# The bash tool runs real commands: give it the usual ones.
RUN apt-get update \
 && apt-get install -y --no-install-recommends bash ca-certificates curl git less procps \
 && rm -rf /var/lib/apt/lists/*

# mm is one static binary (CGO disabled). It is checked against the
# release's SHA256SUMS before it is installed.
ARG MM_VERSION=1.0.3
ARG TARGETARCH
RUN set -eu; \
    case "$TARGETARCH" in \
      amd64) asset=37fe369a-f181-4109-a2b5-6ed8b51f0da3; sum=e93ce6e34a326268b2a1399dbfe8d8f3b51d516d817b691b114e71cbb5981285 ;; \
      arm64) asset=29ec0778-2e41-48a4-8153-996705ec4a83; sum=31aebcbe75caea8cad828eb36092efbe29fb13921691c0c80be1cd93f6c67f65 ;; \
      *) echo "no mm for $TARGETARCH" >&2; exit 1 ;; \
    esac; \
    curl -fsSL -o /usr/local/bin/mm "https://rickub.com/bots-garden/mini-me/release-assets/$asset"; \
    echo "$sum  /usr/local/bin/mm" | sha256sum -c -; \
    chmod +x /usr/local/bin/mm; \
    mm -version || true

# Nothing to run by default: the container waits, Sidekicks runs mm in it.
CMD ["sleep", "infinity"]
