Bleak/Llama-Cpp-Python-Qwen3
0
1#Ollama-API By BleakPrestiger2# Builder stage3FROM python:latest4 5WORKDIR /app6 7RUN apt-get update && \8 apt-get install -y --no-install-recommends python3 python3-pip && \9 rm -rf /var/lib/apt/lists/*10 11# In your Dockerfile12RUN pip install huggingface_hub "huggingface_hub[cli]" llama-cpp-python[server] --break-system-packages13#RUN huggingface-cli download unsloth/Qwen3-4B-Thinking-2507-GGUF Qwen3-4B-Thinking-2507-Q4_K_M.gguf --local-dir . --local-dir-use-symlinks False14 15# Download the model during the build process16RUN python3 -c "from huggingface_hub import hf_hub_download; hf_hub_download(repo_id='unsloth/Qwen3-4B-Thinking-2507-GGUF', filename='Qwen3-4B-Thinking-2507-Q4_K_M.gguf', local_dir='.')"17 18# Update packages and install curl and gnupg19RUN apt-get update && apt-get upgrade -y && apt-get install -y \20 curl \21 wget \22 gnupg23 24#RUN cd llama-b6795-bin-ubuntu-x64/build/bin && chmod +x ./llama-server && ./llama-server --model Qwen3-1.7B-Q8_0.gguf --ctx-size-draft 32767 --ctx-size 32767 --temp 1.0 --top-k 64 --top-k 0.95 --min-p 0.0 --log-file llama.log &25 26COPY .. /app27 28RUN ls29 30# Copy the entry point script31COPY entrypoint.sh /entrypoint.sh32RUN chmod +x /entrypoint.sh33# Set the entry point script as the default command34ENTRYPOINT ["/entrypoint.sh"]35#CMD ["ollama", "serve"]36 37# Expose the server port38EXPOSE 786039 40# Add NVIDIA package repositories41#RUN curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \42 #&& echo "deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://nvidia.github.io/libnvidia-container/stable/deb/ $(. /etc/os-release; echo $UBUNTU_CODENAME) main" > /etc/apt/sources.list.d/nvidia-container-toolkit.list43 44# Install NVIDIA container toolkit (Check for any updated methods or URLs for Ubuntu jammy)45#RUN apt-get update && apt-get install -y nvidia-container-toolkit || true46 47# Install application48#RUN curl https://ollama.ai/install.sh | sh49# Below is to fix embedding bug as per50# RUN curl -fsSL https://ollama.com/install.sh | sed 's#https://ollama.com/download#https://github.com/jmorganca/ollama/releases/download/v0.1.29#' | sh51 52 53# Create the directory and give appropriate permissions54#RUN mkdir -p /.ollama && chmod 777 /.ollama55 56#WORKDIR /.ollama57 58# Set the entry point script as the default command59#ENTRYPOINT ["/entrypoint.sh"]60#CMD ["ollama", "serve"]61 62# Set the model as an environment variable (this can be overridden)63#ENV model=${model}