FROM python:3.11-slim ARG TORCH_CUDA=cu121 WORKDIR /app RUN apt-get update && apt-get install -y --no-install-recommends \ libpq-dev \ gcc \ git \ && rm -rf /var/lib/apt/lists/* ENV PYTHONUNBUFFERED=1 \ PIP_DISABLE_PIP_VERSION_CHECK=1 \ TOKENIZERS_PARALLELISM=false \ HF_HUB_DISABLE_SYMLINKS_WARNING=1 COPY requirements.txt ./ RUN python -m pip install --no-cache-dir --upgrade pip setuptools wheel RUN if [ "$TORCH_CUDA" = "cu121" ]; then \ pip install --no-cache-dir --index-url https://download.pytorch.org/whl/cu121 \ torch==2.4.1 torchvision==0.19.1 torchaudio==2.4.1 ; \ else \ pip install --no-cache-dir --index-url https://download.pytorch.org/whl/cpu \ torch==2.4.1 torchvision==0.19.1 torchaudio==2.4.1 ; \ fi RUN pip install --no-cache-dir -r requirements.txt RUN python -m spacy download es_core_news_md || true COPY . . RUN python download_models.py || true EXPOSE 8000