# Build context is ./monitor (NOT ./monitor/collector) so the image can also
# carry agent/agent.py — the collector serves it to the one-line installer.
FROM python:3.12-slim
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends rclone \
    && rm -rf /var/lib/apt/lists/* \
    && pip install --no-cache-dir fastapi uvicorn pymongo
COPY collector/main.py collector/start.sh collector/deploy_agent.sh ./
COPY agent/agent.py ./agent_src/agent.py
# staged base image for clients that can't reach Docker Hub (may be empty)
COPY collector/baseimg/ ./baseimg/
RUN chmod +x start.sh && sed -i 's/\r$//' start.sh deploy_agent.sh
CMD ["/bin/sh", "/app/start.sh"]
