# ============================================================ # Mithal.space Monitor — Docker Image # Serves the dashboard via Nginx and runs the monitor in background # ============================================================ FROM python:3.12-slim # Prevent Python from buffering stdout/stderr ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 # Install system deps for nginx RUN apt-get update && \ apt-get install -y --no-install-recommends nginx curl && \ rm -rf /var/lib/apt/lists/* # Remove default nginx site RUN rm -f /etc/nginx/sites-enabled/default # Set working directory WORKDIR /app # Install Python dependencies first (layer caching) COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy application files COPY monitor.py . COPY dashboard.html /usr/share/nginx/html/index.html COPY style.css /usr/share/nginx/html/ COPY script.js /usr/share/nginx/html/ COPY metrics.json /usr/share/nginx/html/metrics.json COPY nginx.conf /etc/nginx/conf.d/default.conf # Create log directory RUN mkdir -p /var/log/nginx && \ touch /app/monitor.log # Expose port 80 EXPOSE 80 # Start script: run monitor in background, nginx in foreground COPY entrypoint.sh /entrypoint.sh RUN chmod +x /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"]