FROM python:3.11-slim

WORKDIR /app

COPY monitor.py ./
COPY dashboard/ ./dashboard/
COPY start.sh ./

RUN chmod +x start.sh && mkdir -p dashboard/data

EXPOSE 8080

HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \
  CMD python3 -c "import urllib.request; urllib.request.urlopen('http://localhost:8080/', timeout=5)" || exit 1

CMD ["./start.sh"]
