2023-12-22 12:16:02 +01:00
|
|
|
ARG UBUNTU_VERSION=22.04
|
|
|
|
# This needs to generally match the container host's environment.
|
|
|
|
ARG CUDA_VERSION=12.3.1
|
|
|
|
# Target the CUDA build image
|
|
|
|
ARG BASE_CUDA_DEV_CONTAINER=nvidia/cuda:${CUDA_VERSION}-devel-ubuntu${UBUNTU_VERSION}
|
|
|
|
# Target the CUDA runtime image
|
|
|
|
ARG BASE_CUDA_RUN_CONTAINER=nvidia/cuda:${CUDA_VERSION}-runtime-ubuntu${UBUNTU_VERSION}
|
|
|
|
|
|
|
|
FROM ${BASE_CUDA_DEV_CONTAINER} AS build
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
# Unless otherwise specified, we make a fat build.
|
|
|
|
ARG CUDA_DOCKER_ARCH=all
|
|
|
|
# Set nvcc architecture
|
|
|
|
ENV CUDA_DOCKER_ARCH=${CUDA_DOCKER_ARCH}
|
|
|
|
# Enable cuBLAS
|
2024-06-26 18:34:09 +02:00
|
|
|
ENV GGML_CUDA=1
|
2023-12-22 12:16:02 +01:00
|
|
|
|
|
|
|
RUN apt-get update && \
|
2024-09-20 14:36:43 +02:00
|
|
|
apt-get install -y build-essential libsdl2-dev \
|
2023-12-22 12:16:02 +01:00
|
|
|
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/*
|
|
|
|
|
2023-12-30 22:12:31 +01:00
|
|
|
# Ref: https://stackoverflow.com/a/53464012
|
|
|
|
ENV CUDA_MAIN_VERSION=12.3
|
|
|
|
ENV LD_LIBRARY_PATH /usr/local/cuda-${CUDA_MAIN_VERSION}/compat:$LD_LIBRARY_PATH
|
|
|
|
|
2023-12-22 12:16:02 +01:00
|
|
|
COPY .. .
|
|
|
|
RUN make
|
|
|
|
|
|
|
|
FROM ${BASE_CUDA_RUN_CONTAINER} AS runtime
|
2024-03-20 17:45:15 +01:00
|
|
|
ENV CUDA_MAIN_VERSION=12.3
|
|
|
|
ENV LD_LIBRARY_PATH /usr/local/cuda-${CUDA_MAIN_VERSION}/compat:$LD_LIBRARY_PATH
|
2023-12-22 12:16:02 +01:00
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
RUN apt-get update && \
|
|
|
|
apt-get install -y curl ffmpeg \
|
|
|
|
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/*
|
|
|
|
|
|
|
|
COPY --from=build /app /app
|
|
|
|
ENTRYPOINT [ "bash", "-c" ]
|