Files
TTN-VEGAPULS-Air-exporter/Dockerfile
2026-01-04 11:32:33 +01:00

38 lines
899 B
Docker

FROM python:3.11-slim
# Set metadata
LABEL maintainer="mail@hendrikschutter.com"
LABEL description="Prometheus exporter for VEGAPULS Air sensors via The Things Network"
LABEL version="2.0"
# Create app directory
WORKDIR /app
# Install dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy application files
COPY ttn-vegapulsair-exporter.py .
COPY config.py .
# Create non-root user
RUN useradd -r -u 1000 -g users exporter && \
chown -R exporter:users /app
# Switch to non-root user
USER exporter
# Expose metrics port
EXPOSE 9106
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \
CMD python -c 'import urllib.request; urllib.request.urlopen("http://localhost:9106/health")' || exit 1
# Set environment variables
ENV PYTHONUNBUFFERED=1
# Run the exporter
CMD ["python", "ttn-vegapulsair-exporter.py"]