# vision-manager — tiny sidecar that starts/stops mangalord-vision by name
# according to the analysis backlog. See manager.sh and VISION-AUTOSCALE.md.
FROM alpine:3.20

# bash (the script uses arrays/arithmetic), curl (/health probe),
# postgresql-client (psql backlog query), docker-cli (start/stop via the
# socket-proxy). No daemon, no compiled build.
RUN apk add --no-cache bash curl postgresql-client docker-cli

COPY manager.sh /usr/local/bin/manager.sh
RUN chmod +x /usr/local/bin/manager.sh

# Run unprivileged: the container only needs to reach the socket-proxy over
# TCP and Postgres — it never touches the host socket directly.
USER nobody

ENTRYPOINT ["bash", "/usr/local/bin/manager.sh"]
