FROM python:3.11-slim ENV PYTHONDONTWRITEBYTECODE=1 \ PYTHONUNBUFFERED=1 \ TRANSFORMERS_CACHE=/tmp/hf_cache \ HF_HOME=/tmp/hf_cache \ SENTENCE_TRANSFORMERS_HOME=/tmp/hf_cache RUN apt-get update && apt-get install -y --no-install-recommends git \ && rm -rf /var/lib/apt/lists/* WORKDIR /app COPY requirements.txt . # (optional) keep pip up to date, then install deps RUN pip install --no-cache-dir --upgrade pip \ && pip install --no-cache-dir -r requirements.txt # Ensure cache dir exists & is writable RUN mkdir -p /tmp/hf_cache && chmod -R 777 /tmp/hf_cache COPY main.py . # ENV MODEL_NAME=sentence-transformers/all-MiniLM-L6-v2 # ENV API_TOKEN=changeme CMD ["bash", "-lc", "uvicorn main:app --host 0.0.0.0 --port ${PORT:-7860}"]