katara / Dockerfile
dkdaniz's picture
Update Dockerfile
41adfc5
raw
history blame
No virus
1.44 kB
# 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.
ARG CUDA_IMAGE="12.1.1-devel-ubuntu22.04"
FROM nvidia/cuda:${CUDA_IMAGE}
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.
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 apt-get update && apt-get install -y software-properties-common
RUN apt-get install -y g++-11
ENV CUDA_DOCKER_ARCH=all
ENV LLAMA_CUBLAS=1
# only copy what's needed at every step to optimize layer cache
COPY ./requirements.txt .
# use BuildKit cache mount to drastically reduce redownloading from pip on repeated builds
RUN CMAKE_ARGS="-DLLAMA_CUBLAS=on" pip install requirements.txt llama-cpp-python
COPY SOURCE_DOCUMENTS ./SOURCE_DOCUMENTS
COPY ingest.py constants.py ./
ARG device_type=cuda
RUN python3 ingest.py --device_type $device_type
COPY . .
ENV device_type=cuda
CMD python3 run_localGPT.py --device_type $device_type