# The agent reuses the backend image (same compose/Docker code + deps) and
# just runs a different ASGI app. Build the backend image first.
ARG BACKEND_IMAGE=git.menzel.center/menzeljonas/stackpilot-backend:latest
FROM ${BACKEND_IMAGE}

ENV STACKS_DIR=/opt/stacks \
    PORT=5010

EXPOSE 5010

HEALTHCHECK --interval=30s --timeout=5s --start-period=10s \
    CMD curl -fsS http://localhost:5010/agent/health || exit 1

# Wie beim Backend: falls jemand einen TLS-Proxy vor den Agent setzt, soll die
# echte Client-IP in den Logs stehen.
CMD ["uvicorn", "agent_app:app", "--host", "0.0.0.0", "--port", "5010", \
     "--proxy-headers", "--forwarded-allow-ips", "*"]
