FROM python:3.9-slim

WORKDIR /code

ENV TRANSFORMERS_CACHE /tmp/transformers_cache
RUN mkdir -p $TRANSFORMERS_CACHE && chmod -R 777 $TRANSFORMERS_CACHE

ENV MPLCONFIGDIR /tmp/matplotlib_config
RUN mkdir -p $MPLCONFIGDIR && chmod -R 777 $MPLCONFIGDIR

RUN apt-get update && apt-get install -y --no-install-recommends \
    build-essential gcc \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

RUN pip install --no-cache-dir Cython

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

COPY ./multi_lingual.py ./urdu_punkt.py ./main.py /code/
COPY ./models/ /code/models/

CMD ["python", "main.py"]