FROM nvidia/cuda:11.3.1-cudnn8-devel-ubuntu18.04 ARG CTRANSFORMERS_VERSION="0.2.5" ARG CMAKE_VERSION=3.26 ARG CMAKE_VERSION_PATCH=3.26.3 ARG CMAKE_OS=linux ARG DEBIAN_FRONTEND=noninteractive ENV TZ=UTC RUN apt-get update && \ apt-get install --no-install-recommends -y \ curl git vim build-essential software-properties-common python3 python3-pip python3-dev python3-venv \ libffi-dev libncurses5-dev zlib1g zlib1g-dev libreadline-dev libbz2-dev libsqlite3-dev libssl-dev \ libblas-dev liblapack-dev cmake && \ add-apt-repository ppa:ubuntu-toolchain-r/test && \ apt-get update && \ apt install --no-install-recommends -y gcc-10 g++-10 && \ update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10 --slave /usr/bin/gcov gcov /usr/bin/gcov-10 && \ rm -rf /var/lib/apt/lists/* && \ pip3 install scikit-build RUN curl -L https://cmake.org/files/v$CMAKE_VERSION/cmake-$CMAKE_VERSION_PATCH-$CMAKE_OS-x86_64.sh -o /tmp/cmake-$CMAKE_VERSION_PATCH-$CMAKE_OS-x86_64.sh && \ mkdir /opt/cmake && \ sh /tmp/cmake-$CMAKE_VERSION_PATCH-$CMAKE_OS-x86_64.sh --skip-license --prefix=/opt/cmake && \ ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake RUN useradd -m -u 1000 appuser WORKDIR /build RUN chown appuser:appuser /build USER appuser ENV HOME /home/appuser ENV PYENV_ROOT $HOME/.pyenv ENV PATH $PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH RUN git clone --depth 1 --branch v$CTRANSFORMERS_VERSION https://github.com/marella/ctransformers.git /build RUN curl https://pyenv.run | bash RUN pyenv install 3.8.9 && \ pyenv global 3.8.9 && \ pyenv rehash && \ pip install --no-cache-dir --upgrade pip==22.3.1 setuptools wheel && \ pip install --no-cache-dir datasets "huggingface-hub>=0.12.1" "protobuf<4" "click<8.1" "scikit-build" && \ CT_CUBLAS=1 python3 setup.py bdist_wheel && \ ls -l /build/dist/