FROM python:3.11

# Set the working directory
WORKDIR /app

# Copy the requirements file
COPY ./requirements.txt /app/

# Install dependencies and set up Python environment
RUN apt-get update && apt-get install -y --no-install-recommends \
    zstd \
    curl \
    git \
    build-essential \
    python3-pip \
    libreoffice-writer-nogui \
    && rm -rf /var/lib/apt/lists/*

# RUN curl -fsSL https://ollama.com/install.sh | sh


RUN pip install --upgrade pip

WORKDIR /app

RUN pip install --no-cache-dir -r requirements.txt
RUN pip install nltk
# Avoid runtime GitHub downloads (slow/hanging in some networks) before Uvicorn starts.
RUN python3 -m nltk.downloader punkt punkt_tab stopwords averaged_perceptron_tagger_eng wordnet

COPY . /app/

EXPOSE 4402 
ENTRYPOINT ["/app/entrypoint.sh"]