# Image du microservice holehe. Volontairement séparée de celle de Limier :
# licence GPLv3 distincte, cycle de mise à jour distinct.
FROM python:3.12-slim-bookworm

ENV PYTHONUNBUFFERED=1 PYTHONDONTWRITEBYTECODE=1 TZ=Europe/Paris

RUN apt-get update \
 && apt-get install -y --no-install-recommends tzdata ca-certificates curl \
 && ln -snf /usr/share/zoneinfo/$TZ /etc/localtime \
 && rm -rf /var/lib/apt/lists/*

WORKDIR /app
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt

COPY app.py LICENSE ./

RUN useradd -r -u 1000 -d /app -s /sbin/nologin holehe && chown -R holehe /app
USER holehe

EXPOSE 8080
HEALTHCHECK --interval=60s --timeout=5s --start-period=20s --retries=3 \
  CMD curl -fsS http://127.0.0.1:8080/sante || exit 1

CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8080"]
