FROM python:3.11-slim WORKDIR /app RUN apt-get update && apt-get install -y --no-install-recommends \ wget \ && rm -rf /var/lib/apt/lists/* # Install PyTorch CPU-only. # The PyTorch whl/cpu index only has x86 wheels; on aarch64 we fall back to # regular PyPI which publishes native aarch64 wheels for torch 2.x. RUN pip install --no-cache-dir \ --extra-index-url https://download.pytorch.org/whl/cpu \ torch RUN pip install --no-cache-dir \ transformers==4.44.2 \ fastapi==0.115.0 \ "uvicorn[standard]==0.30.6" \ pydantic==2.9.2 \ sentencepiece \ accelerate COPY app.py . EXPOSE 8881 CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8881", "--workers", "1"]