phi3-ds-expert / Dockerfile
rizzdeep's picture
Update Dockerfile
5051931 verified
Raw History Blame Contribute Delete
917 Bytes
FROM python:3.11-slim
WORKDIR /app
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
RUN pip install --no-cache-dir huggingface_hub
# Set cache directory
ENV HF_HOME=/data/hf_cache
# Create offload directory with correct permissions
RUN mkdir -p /data/model_offload && chmod -R 777 /data/model_offload
# Create cache directory with writable permissions for runtime
RUN mkdir -p /data/hf_cache/hub/models--microsoft--Phi-3-mini-4k-instruct/blobs && chmod -R 777 /data/hf_cache
# Pre-download base model to cache
RUN python -c "from huggingface_hub import snapshot_download; \
snapshot_download(repo_id='microsoft/Phi-3-mini-4k-instruct', local_dir='/data/hf_cache/models--microsoft--Phi-3-mini-4k-instruct')"
COPY . .
EXPOSE 7860
CMD ["uvicorn", "main:app", "--host=0.0.0.0", "--port=7860"]