FROM python:3.12-slim

RUN apt-get update && apt-get install --no-install-recommends -y libmagic1 libolm3 libolm-dev git && rm -rf /var/lib/apt/lists/*

WORKDIR /usr/src/app

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

COPY . .

WORKDIR /runtime
RUN chown -R 1000:1000 /usr/src /runtime

USER 1000:1000
CMD [ "python", "/usr/src/app/main.py" ]