FROM python:3.11-slim

WORKDIR /app

# Install system dependencies if required
RUN apt-get update && apt-get install -y --no-install-recommends \
    ca-certificates \
    && rm -rf /var/lib/apt/lists/*

# Install Python requirements
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Copy application files
COPY monitor.py index.html entrypoint.sh chart.umd.min.js ./
COPY data.jsonl data.csv monitoring_data.csv data.js ./

# Create symlink so dashboard.html also works without code duplication
RUN ln -sf index.html dashboard.html && chmod +x entrypoint.sh

# Expose HTTP dashboard port
EXPOSE 8080

# Run entrypoint script
ENTRYPOINT ["/app/entrypoint.sh"]
