-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathDockerfile-base
86 lines (66 loc) · 3.11 KB
/
Dockerfile-base
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# Include Python
ARG CUDA_VERSION="11.8.0"
ARG CUDNN_VERSION="8"
ARG UBUNTU_VERSION="22.04"
FROM nvidia/cuda:$CUDA_VERSION-cudnn$CUDNN_VERSION-devel-ubuntu$UBUNTU_VERSION as base-builder
#FROM 11.8.0-cudnn8-devel-ubuntu22.04 as base-builder
ARG PYTHON_VERSION="3.9"
ARG PYTORCH="2.0.0"
ARG CUDA="118"
ENV PYTHON_VERSION=${PYTHON_VERSION}
RUN apt-get update
RUN apt-get install -y wget git build-essential ninja-build git-lfs libaio-dev && rm -rf /var/lib/apt/lists/*
RUN useradd -m -u 1000 appuser
WORKDIR /workspace
RUN chown appuser:appuser /workspace
USER appuser
ENV HOME /home/appuser
ENV PATH="${HOME}/miniconda3/bin:${PATH}"
RUN wget \
https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh \
&& mkdir ${HOME}/.conda \
&& bash Miniconda3-latest-Linux-x86_64.sh -b -p ${HOME}/miniconda3 \
&& rm -f Miniconda3-latest-Linux-x86_64.sh
RUN conda create -n "py${PYTHON_VERSION}" python="${PYTHON_VERSION}"
ENV PATH="${HOME}/miniconda3/envs/py${PYTHON_VERSION}/bin:${PATH}"
RUN python3 -m pip install --upgrade pip && pip3 install packaging && \
python3 -m pip install --no-cache-dir -U torch==${PYTORCH} torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu$CUDA
FROM base-builder as ggml-builder
ARG CTRANSFORMERS_VERSION="v0.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
USER root
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 libopenblas-dev liblzma-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
USER appuser
WORKDIR /build
RUN git clone --depth 1 --branch $CTRANSFORMERS_VERSION https://github.com/marella/ctransformers.git /build/ctransformers
RUN pip3 install --no-cache-dir datasets "huggingface-hub>=0.12.1" "protobuf<4" "click<8.1" "scikit-build" && \
cd ctransformers && \
CT_CUBLAS=1 python3 setup.py bdist_wheel
FROM base-builder
# Define your working directory
WORKDIR /workspace
# Install runpod
RUN mkdir -p /workspace/builds
COPY --from=ggml-builder /build/ctransformers /workspace/builds/ctransformers
COPY requirements.txt .
RUN pip3 install -r requirements.txt && \
pip install /workspace/builds/ctransformers/dist/*.whl && \
rm requirements.txt