| FROM python:3.12-slim |
|
|
| |
| RUN apt-get update && apt-get install -y \ |
| build-essential \ |
| libpq-dev \ |
| curl \ |
| && rm -rf /var/lib/apt/lists/* |
|
|
| |
| RUN useradd -m -u 1000 user |
| USER user |
| ENV PATH="/home/user/.local/bin:$PATH" |
|
|
| WORKDIR /app |
|
|
| |
| COPY --chown=user ./requirements.txt requirements.txt |
| RUN pip install --no-cache-dir --upgrade pip && \ |
| pip install --no-cache-dir -r requirements.txt |
|
|
| |
| RUN python -m spacy download pt_core_news_md |
|
|
| |
| RUN python -c "from transformers import T5Tokenizer, T5ForConditionalGeneration; \ |
| T5Tokenizer.from_pretrained('unicamp-dl/ptt5-base-portuguese-vocab'); \ |
| T5ForConditionalGeneration.from_pretrained('recogna-nlp/ptt5-base-summ')" |
|
|
| |
| COPY --chown=user . /app |
|
|
| |
| EXPOSE 7860 |
|
|
| |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |