api_sentiments_tweets / Dockerfile
Neomac21's picture
initial
f8c01d7
Raw
History Blame Contribute Delete
562 Bytes
FROM python:3.11
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 -r requirements.txt
# Pré-télécharge le modèle pendant le build (baked dans l'image → démarrage rapide)
RUN python -c "from transformers import pipeline; pipeline('sentiment-analysis', model='cardiffnlp/twitter-roberta-base-sentiment-latest')"
COPY --chown=user . /app
EXPOSE 7860
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]