# syntax=docker/dockerfile:1

# Alleen de standaardbibliotheek: geen pip-installatie, geen compilers.
FROM python:3.13-slim

LABEL org.opencontainers.image.title="Labwereld" \
      org.opencontainers.image.licenses="EUPL-1.2" \
      org.opencontainers.image.url="https://labwereld.wiehie.nl"

ENV PYTHONDONTWRITEBYTECODE=1 \
    PYTHONUNBUFFERED=1 \
    LABWERELD_LISTEN=0.0.0.0:8787 \
    LABWERELD_ENV_FILE=/config/labwereld.env \
    LABWERELD_DEFAULT_SOURCE=demo \
    LABWERELD_DATA_DIR=/data

WORKDIR /app
COPY collector collector
COPY config config
COPY web web

# De verzamelaar heeft nooit root nodig.
RUN useradd --system --uid 10001 --no-create-home labwereld \
 && install -d -o 10001 -m 0750 /data
USER labwereld

EXPOSE 8787

HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \
  CMD ["python3", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8787/api/healthz', timeout=4)"]

CMD ["python3", "-m", "collector"]
