MuriL-2.0 / Dockerfile
Sai809701
updated files
6677176
# Dockerfile β€” CPU-optimized, robust for Hugging Face Spaces / local deployment
FROM python:3.11-slim
ENV DEBIAN_FRONTEND=noninteractive
WORKDIR /app
# ---------------------------
# System deps
# ---------------------------
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential git curl ca-certificates libsndfile1 \
&& rm -rf /var/lib/apt/lists/*
# ---------------------------
# Copy requirements files
# ---------------------------
# We'll install torch (CPU) first from the official PyTorch index, then install other requirements.
COPY requirements.txt /app/requirements.txt
# ---------------------------
# Install PyTorch CPU wheel first to avoid torchvision/torch mismatch
# (adjust CPU wheel index if you want GPU/CUDA variant)
# ---------------------------
RUN pip --no-cache-dir install --upgrade pip setuptools wheel \
&& pip --no-cache-dir install --index-url https://download.pytorch.org/whl/cpu \
"torch>=2.1.0" "torchvision>=0.16.0" "torchaudio>=2.1.0" \
&& pip --no-cache-dir install --no-deps -r /app/requirements.txt
# ---------------------------
# Copy app code
# ---------------------------
COPY . /app
# Make entrypoint executable
RUN chmod +x /app/entrypoint.sh || true
# Create export artifacts dir (mountable)
RUN mkdir -p /app/export_artifacts
# Default envs (override at runtime)
ENV HF_REPO="Sp2503/Finetuned-multilingualdataset-MuriL-model"
ENV MODEL_DIR="$HF_REPO"
ENV CSV_PATH="/app/export_artifacts/muril_multilingual_dataset.csv"
ENV OUT_EMBED_PATH="/app/export_artifacts/answer_embeddings.pt"
ENV HF_CACHE_DIR="/app/hf_cache"
ENV UPLOAD_BACK="false"
ENV FORCE_REGEN="false"
ENV PORT=7860
ENV DEVICE="cpu"
EXPOSE ${PORT}
# ENTRYPOINT: run regeneration (if required) and start uvicorn
ENTRYPOINT ["/app/entrypoint.sh"]