FROM ubuntu:22.04 RUN apt-get update && apt-get install -y --no-install-recommends \ python3 python3-pip curl ca-certificates \ && rm -rf /var/lib/apt/lists/* # Download llama.cpp pre-built binary (latest ubuntu x64) RUN curl -L https://github.com/ggml-org/llama.cpp/releases/download/b8468/llama-b8468-bin-ubuntu-x64.tar.gz \ -o /tmp/llama.tar.gz \ && mkdir -p /opt/llama \ && tar xzf /tmp/llama.tar.gz -C /opt/llama \ && rm /tmp/llama.tar.gz \ && find /opt/llama -name "llama-server" -exec dirname {} \; > /tmp/bindir.txt \ && echo "Binary dir: $(cat /tmp/bindir.txt)" # Make all llama binaries accessible ENV PATH="/opt/llama/build/bin:/opt/llama/bin:$PATH" \ LD_LIBRARY_PATH="/opt/llama/build/bin:/opt/llama/lib:/opt/llama:$LD_LIBRARY_PATH" # Add symlinks so llama-server is always found RUN find /opt/llama -name "llama-server" -exec ln -sf {} /usr/local/bin/llama-server \; \ && find /opt/llama -name "*.so*" -exec cp {} /usr/local/lib/ \; 2>/dev/null; ldconfig || true RUN useradd -m -u 1000 user USER user ENV HOME=/home/user PATH="/home/user/.local/bin:/usr/local/bin:$PATH" WORKDIR /home/user/app RUN pip3 install --no-cache-dir --user gradio huggingface_hub openai COPY --chown=user app.py . COPY --chown=user start.sh . RUN chmod +x start.sh EXPOSE 7860 CMD ["bash", "start.sh"]