FROM python:3

ENV PYTHONUNBUFFERED=value

WORKDIR /usr/src/app

COPY requirements.txt ./

RUN pip install --no-cache-dir --extra-index-url https://download.pytorch.org/whl/cpu -r requirements.txt

RUN apt update && apt install -y ffmpeg libsm6 libxext6

COPY src .
COPY best.pt /best.pt

RUN chown -R 1000 /usr/src/app
RUN mkdir /.config
RUN mkdir /.cache
RUN chown -R 1000 /.config
RUN chown -R 1000 /.cache

USER 1000

CMD [ "gunicorn", "-b 0.0.0.0:80", "--workers", "1", "app:app" ]
