/ .devops / full-cuda.Dockerfile
full-cuda.Dockerfile
 1  ARG UBUNTU_VERSION=22.04
 2  # This needs to generally match the container host's environment.
 3  ARG CUDA_VERSION=12.6.0
 4  # Target the CUDA build image
 5  ARG BASE_CUDA_DEV_CONTAINER=nvidia/cuda:${CUDA_VERSION}-devel-ubuntu${UBUNTU_VERSION}
 6  
 7  FROM ${BASE_CUDA_DEV_CONTAINER} AS build
 8  
 9  # CUDA architecture to build for (defaults to all supported archs)
10  ARG CUDA_DOCKER_ARCH=default
11  
12  RUN apt-get update && \
13      apt-get install -y build-essential cmake python3 python3-pip git libcurl4-openssl-dev libgomp1
14  
15  COPY requirements.txt   requirements.txt
16  COPY requirements       requirements
17  
18  RUN pip install --upgrade pip setuptools wheel \
19      && pip install -r requirements.txt
20  
21  WORKDIR /app
22  
23  COPY . .
24  
25  # Use the default CUDA archs if not specified
26  RUN if [ "${CUDA_DOCKER_ARCH}" != "default" ]; then \
27          export CMAKE_ARGS="-DCMAKE_CUDA_ARCHITECTURES=${CUDA_DOCKER_ARCH}"; \
28      fi && \
29      cmake -B build -DGGML_NATIVE=OFF -DGGML_CUDA=ON -DLLAMA_CURL=ON ${CMAKE_ARGS} -DCMAKE_EXE_LINKER_FLAGS=-Wl,--allow-shlib-undefined . && \
30      cmake --build build --config Release -j$(nproc) && \
31      cp build/bin/* .
32  
33  ENTRYPOINT ["/app/.devops/tools.sh"]