Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files12345678910111213141516171819202122FROM python:3.10-bullseyeWORKDIR /app# Install only the essentialsRUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*# Force PIP to use CPU-only binaries and avoid the build-stage entirelyENV PIP_PREFER_BINARY=1RUN pip install --no-cache-dir fastapi uvicornRUN pip install llama-cpp-python \--extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu# Download the model (MPT-7B Q2)# We do this AFTER the install so if the model fails, we don't have to reinstall toolsRUN curl -L "https://huggingface.co/maddes8cht/mosaicml-mpt-7b-chat-gguf/resolve/main/mosaicml-mpt-7b-chat-Q2_K.gguf?download=true" -o mpt-7b-q2.ggufCOPY app.py .EXPOSE 7860CMD ["python", "app.py"]12345678910111213141516171819202122# Use the official pre-compiled image (CPU version)FROM ghcr.io/abetlen/llama-cpp-python:latestWORKDIR /app# 1. Install curl and move to the right folderRUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*# 2. Download the model using the CLI (most stable)RUN pip install huggingface_hubRUN huggingface-cli download maddes8cht/mosaicml-mpt-7b-chat-gguf mosaicml-mpt-7b-chat-Q2_K.gguf --local-dir . --local-dir-use-symlinks FalseRUN mv mosaicml-mpt-7b-chat-Q2_K.gguf mpt-7b-q2.gguf# 3. Copy your app codeCOPY app.py .# Force the port to 7860 for Hugging FaceENV PORT=7860EXPOSE 7860# Use the python inside the container to run your appCMD ["python3", "app.py"]
Dockerfile+12-12