71 lines
2.9 KiB
Docker
71 lines
2.9 KiB
Docker
### LLaMACpp Builder Container with Adreno GPU Support
|
|
### Multi-stage: download stage with pre-built binaries, runtime stage with only runtime libraries
|
|
### Optimized for ARM64 Adreno GPUs with Vulkan backend
|
|
###
|
|
### BUILD: podman build -t llamacpp:adreno-arm64 -f llamacpp-adreno.Containerfile .
|
|
### Export: podman save -o /home/badstorm/llamacpp-adreno-arm64.tar localhost/llamacpp:adreno-arm64
|
|
|
|
FROM ubuntu:26.04
|
|
|
|
USER root
|
|
EXPOSE 8090
|
|
|
|
# Install build dependencies and tools
|
|
RUN apt-get update \
|
|
&& apt-get install -y curl tar grep sed git ffmpeg nano python3-pip python3 python3-wheel \
|
|
&& pip install --break-system-packages --upgrade setuptools \
|
|
&& pip install --break-system-packages -U "huggingface_hub[cli]" \
|
|
&& if [ -f requirements.txt ]; then pip install --break-system-packages -r requirements.txt; fi \
|
|
&& apt autoremove -y \
|
|
&& apt clean -y \
|
|
&& rm -rf /tmp/* /var/tmp/* \
|
|
&& rm -rf /var/lib/apt/lists/* \
|
|
&& find /var/cache/apt/archives /var/lib/apt/lists -not -name lock -type f -delete \
|
|
&& find /var/cache -type f -delete
|
|
|
|
WORKDIR /app
|
|
|
|
# Mesa 26.2.0-rc3 buildato da noi (build-mesa.sh): su Debian experimental e' solo amd64/i386, niente arm64 ancora
|
|
# Remove conflicting Mesa packages first to avoid file conflicts
|
|
COPY deb/mesa-freedreno-subgroups_*.deb /tmp/
|
|
RUN apt-get update \
|
|
&& apt-get remove -y --allow-remove-essential libgl1-mesa-dri libglx-mesa0 libglx0 mesa-opencl-icd || true \
|
|
&& dpkg --force-overwrite --install /tmp/mesa-freedreno-subgroups_*.deb \
|
|
&& rm /tmp/mesa-freedreno-subgroups_*.deb \
|
|
&& apt-get install -y --no-install-recommends libvulkan1 \
|
|
&& apt autoremove -y \
|
|
&& apt clean -y \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Download and extract llama.cpp with Vulkan support for ARM64
|
|
# Note: Using Vulkan build as base; Adreno uses Vulkan drivers
|
|
RUN VERSION=$(curl -s https://api.github.com/repos/ggml-org/llama.cpp/releases/latest | grep '"tag_name"' | head -1 | sed 's/.*"tag_name": "\([^"]*\)".*/\1/') \
|
|
&& echo "Last llama.cpp version: $VERSION" \
|
|
&& curl -L https://github.com/ggml-org/llama.cpp/releases/download/${VERSION}/llama-${VERSION}-bin-ubuntu-vulkan-arm64.tar.gz -o llama.tar.gz \
|
|
&& tar -xzf llama.tar.gz -C . --strip-components=1 \
|
|
&& rm llama.tar.gz
|
|
|
|
RUN find /app -maxdepth 1 -type f -exec chmod +x {} \;
|
|
|
|
WORKDIR /app
|
|
|
|
ENV PATH=/app:$PATH
|
|
ENV LD_LIBRARY_PATH=/app:/usr/lib/aarch64-linux-gnu:/usr/lib/arm-linux-gnueabihf:$LD_LIBRARY_PATH
|
|
ENV HF_XET_HIGH_PERFORMANCE=1
|
|
# Adreno-specific environment variables
|
|
ENV VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/freedreno_icd.json
|
|
ENV MESA_GL_VERSION_OVERRIDE=4.6
|
|
ENV MESA_GLSL_VERSION_OVERRIDE=460
|
|
#ENV HF_HOME=
|
|
#ENV HUGGING_FACE_HUB_TOKEN=
|
|
ENV LLAMA_ARG_HOST=0.0.0.0
|
|
ENV LLAMA_ARG_PORT=8090
|
|
ENV LLAMA_ARG_HF_REPO=unsloth/gemma-4-26B-A4B-it-GGUF:IQ2_M
|
|
#ENV LLAMA_ARG_MMPROJ_URL=
|
|
ENV LLAMA_ARG_LOAD_MODE=none
|
|
ENV LLAMA_ARG_CTX_SIZE=120000
|
|
#ENV LLAMA_API_KEY=""
|
|
|
|
ENTRYPOINT ["/app/llama-server"]
|
|
CMD ["--no-warmup"]
|