FROM python:3.12-slim
WORKDIR /app
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY src ./src
RUN groupadd -g 1001 novaos && useradd -r -u 1001 -g 1001 -s /bin/false novaos
USER novaos
ENV TMPDIR=/tmp HOME=/tmp
EXPOSE 3000
# python:3.12-slim has no curl: health-check with python instead
HEALTHCHECK --interval=30s --timeout=5s CMD python -c "import urllib.request,sys; sys.exit(0 if urllib.request.urlopen('http://localhost:3000/health').status==200 else 1)"
CMD ["python", "src/index.py"]
