Spaces:
Running
Running
Update Dockerfile
Browse files12345678910111213141516171819202122232425FROM ghcr.io/ggml-org/llama.cpp:fullWORKDIR /appRUN apt update && apt install -y python3 python3-pip python3-venvRUN python3 -m venv /opt/venvENV PATH="/opt/venv/bin:$PATH"RUN pip install -U pip huggingface_hubRUN python3 -c 'from huggingface_hub import hf_hub_download; \repo="HauhauCS/Gemma-4-E2B-Uncensored-HauhauCS-Aggressive"; \hf_hub_download(repo_id=repo, filename="Gemma-4-E2B-Uncensored-HauhauCS-Aggressive-Q6_K_P.gguf", local_dir="/app"); \hf_hub_download(repo_id=repo, filename="mmproj-Gemma-4-E2B-Uncensored-HauhauCS-Aggressive-f16.gguf", local_dir="/app")'CMD ["--server", \"-m", "/app/Gemma-4-E2B-Uncensored-HauhauCS-Aggressive-Q6_K_P.gguf", \"--mmproj", "/app/mmproj-Gemma-4-E2B-Uncensored-HauhauCS-Aggressive-f16.gguf", \"--host", "0.0.0.0", \"--port", "7860", \"-t", "2", \"--cache-type-k", "q8_0", \"--cache-type-v", "iq4_nl", \"-c", "128000", \"-n", "38912"]12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061# Start from the official llama.cpp image which contains the compiled binary /llama-serverFROM ghcr.io/ggml-org/llama.cpp:full# Set the working directory inside the container to /appWORKDIR /app# 1. INSTALL SYSTEM DEPENDENCIES & NODE.JS# Open-WebUI requires Python for its backend and Node.js components for parts of its build pipeline.# We clear the apt cache at the end to keep the final Docker layer size down.RUN apt update && apt install -y python3 python3-pip python3-venv curl git && \curl -fsSL https://nodesource.com | bash - && \apt install -y nodejs && \rm -rf /var/lib/apt/lists/*# 2. ENVIRONMENT VIRTUALIZATION# Create an isolated Python virtual environment to avoid conflicts with system packages,# and append its bin folder to the system PATH so 'pip' and 'open-webui' execute from it directly.RUN python3 -m venv /opt/venvENV PATH="/opt/venv/bin:$PATH"# Upgrade pip and install open-webui (the UI/agent engine) and huggingface_hub (the download utility)RUN pip install -U pip huggingface_hub open-webui# 3. DOWNLOAD THE MODELS# Use Python to download the main GGUF text model and its corresponding vision/multimodal project matrix file# straight from the Hugging Face Hub, saving them directly into the /app directory.RUN python3 -c 'from huggingface_hub import hf_hub_download; \repo="HauhauCS/Gemma-4-E2B-Uncensored-HauhauCS-Aggressive"; \hf_hub_download(repo_id=repo, filename="Gemma-4-E2B-Uncensored-HauhauCS-Aggressive-Q6_K_P.gguf", local_dir="/app"); \hf_hub_download(repo_id=repo, filename="mmproj-Gemma-4-E2B-Uncensored-HauhauCS-Aggressive-f16.gguf", local_dir="/app")'# 4. ORCHESTRATION & AGENT CONFIGURATION# Set the primary web interface port to 7860 (mandatory for Hugging Face Spaces Docker apps).# Enable the built-in Retrieval-Augmented Generation (RAG) system and set the web search driver to DuckDuckGo.ENV PORT=7860ENV DATA_DIR=/app/dataENV ENABLE_RAG_WEB_SEARCH=TrueENV RAG_WEB_SEARCH_ENGINE=duckduckgo# 5. CREATING THE MULTI-PROCESS STARTUP SCRIPT# Docker can normally only run one command. We write a bash script ('start.sh') to orchestrate two parallel processes:# - Process 1: Spins up '/llama-server' in the background (&) on internal port 8000 using your original configurations.# - Process 2: Starts 'open-webui', point it to the local llama API server, and expose it to the world on port 7860.RUN echo '#!/bin/bash\n\/llama-server \-m /app/Gemma-4-E2B-Uncensored-HauhauCS-Aggressive-Q6_K_P.gguf \--mmproj /app/mmproj-Gemma-4-E2B-Uncensored-HauhauCS-Aggressive-f16.gguf \--host 127.0.0.1 \--port 8000 \-t 2 \--cache-type-k q8_0 \--cache-type-v iq4_nl \-c 128000 \-n 38912 & \n\\n\export OPENAI_API_BASE_URLS="http://127.0.0"\n\export OPENAI_API_KEYS="none"\n\open-webui serve --port 7860\n\' > /app/start.sh && chmod +x /app/start.shCMD ["/app/start.sh"]
Dockerfile+48-12