# syntax=docker/dockerfile:1 # Build as `docker build . -t localgpt`, requires BuildKit. # Run as `docker run -it --mount src="$HOME/.cache",target=/root/.cache,type=bind --gpus=all localgpt`, requires Nvidia container toolkit. FROM nvidia/cuda:11.7.1-runtime-ubuntu22.04 RUN apt-get update && apt-get upgrade -y \ && apt-get install -y git build-essential \ python3 python3-pip gcc wget \ ocl-icd-opencl-dev opencl-headers clinfo \ libclblast-dev libopenblas-dev \ && mkdir -p /etc/OpenCL/vendors && echo "libnvidia-opencl.so.1" > /etc/OpenCL/vendors/nvidia.icd RUN apt-get update && apt-get install -y software-properties-common RUN apt-get install -y g++-11 ENV TRANSFORMERS_CACHE=/root/.cache COPY . . # setting build related env vars ENV CUDA_DOCKER_ARCH=all ENV LLAMA_CUBLAS=1 # Install depencencies RUN python3 -m pip install --upgrade pip pytest cmake \ scikit-build setuptools fastapi uvicorn sse-starlette \ pydantic-settings starlette-context gradio huggingface_hub hf_transfer RUN CMAKE_ARGS="-DLLAMA_CUBLAS=on" pip install llama-cpp-python RUN CMAKE_ARGS="-DLLAMA_CUBLAS=on" pip install --timeout 100 -r requirements.txt RUN chmod +x ./run.sh CMD ./run.sh