FROM python:3.11-slim
WORKDIR /srv
# torch CPU uniquement : image ~1 Go au lieu de ~6 Go avec CUDA
RUN pip install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
ENV MODEL_NAME=gpt2 HF_HOME=/srv/.cache
EXPOSE 8000
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
