Files
homehub4000-prometheus-expo…/Dockerfile
2026-01-05 20:47:00 -05:00

28 lines
846 B
Docker

FROM python:3.13-slim
WORKDIR /app
# Install playwright dependencies and curl for health checks
RUN apt-get update && apt-get install -y --no-install-recommends \
libnss3 libnspr4 libatk1.0-0 libatk-bridge2.0-0 libcups2 libdrm2 \
libxkbcommon0 libxcomposite1 libxdamage1 libxfixes3 libxrandr2 \
libgbm1 libasound2 libpango-1.0-0 libcairo2 curl \
&& rm -rf /var/lib/apt/lists/*
# Install uv
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
# Copy and install
COPY pyproject.toml uv.lock ./
COPY src/ ./src/
RUN uv sync --frozen && uv run playwright install chromium
ENV EXPORTER_PORT=9100
ENV HEADLESS_BROWSER=true
EXPOSE 9100
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
CMD curl -f http://localhost:9100/metrics || exit 1
ENTRYPOINT ["uv", "run", "python", "src/exporter.py"]