FROM python:3.12-slim
WORKDIR /app
RUN pip install --no-cache-dir paho-mqtt requests influxdb-client pulsar-client prometheus_client
COPY simulator.py /app/
EXPOSE 8081
# Healthcheck endpoint (simple HTTP server)
RUN echo '#!/usr/bin/env python3\nimport http.server, threading, os\nclass H(http.server.BaseHTTPRequestHandler):\n    def do_GET(self):\n        self.send_response(200)\n        self.end_headers()\n        self.wfile.write(b"OK")\n    def log_message(self, s, *a): pass\nthreading.Thread(target=lambda: http.server.HTTPServer(("0.0.0.0", 8081), H).serve_forever(), daemon=True).start()\nimport time; time.sleep(86400)' > /healthcheck.py
CMD ["python", "-c", "import simulator; simulator.main()"]
