FROM python:3.12-slim
WORKDIR /app
ENV PYTHONUNBUFFERED=1
RUN pip install --no-cache-dir PyPDF2 bcrypt
RUN adduser --disabled-password --no-create-home appuser
RUN mkdir -p /app/data/images && chown -R appuser /app/data
COPY --chown=appuser server.py .
EXPOSE 8087
HEALTHCHECK --interval=30s --timeout=5s --retries=3 CMD python3 -c "import urllib.request; urllib.request.urlopen('http://localhost:8087/api/health', timeout=3)" || exit 1
USER appuser
CMD ["python3", "server.py"]
