# 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=10.10.6.10:3020/menzelj/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

CMD ["uvicorn", "agent_app:app", "--host", "0.0.0.0", "--port", "5010"]
