-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Dockerfile
139 lines (117 loc) · 3.66 KB
/
Dockerfile
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# Stage 1: Base
FROM nvidia/cuda:12.1.1-cudnn8-devel-ubuntu22.04 as base
ARG OOBABOOGA_COMMIT=4f3fdf1b5ff6884b9899a3630b3ed9aae27decbf
ARG TORCH_VERSION=2.2.0
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
ENV DEBIAN_FRONTEND=noninteractive \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=on \
SHELL=/bin/bash
# Install Ubuntu packages
RUN apt update && \
apt -y upgrade && \
apt install -y --no-install-recommends \
software-properties-common \
python3.10-venv \
python3-pip \
python3-dev \
python3-tk \
bash \
dos2unix \
git \
git-lfs \
ncdu \
nginx \
net-tools \
openssh-server \
libglib2.0-0 \
libsm6 \
libgl1 \
libxrender1 \
libxext6 \
ffmpeg \
wget \
curl \
psmisc \
rsync \
vim \
zip \
unzip \
htop \
screen \
tmux \
pkg-config \
libcairo2-dev \
libgoogle-perftools4 \
libtcmalloc-minimal4 \
apt-transport-https \
ca-certificates && \
update-ca-certificates && \
apt clean && \
rm -rf /var/lib/apt/lists/* && \
echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
ENV PATH="/usr/local/cuda/bin:${PATH}"
# Set Python
RUN ln -s /usr/bin/python3.10 /usr/bin/python
# Stage 2: Install Web UI and python modules
FROM base as setup
# Install Torch
RUN python3 -m venv /venv && \
source /venv/bin/activate && \
pip3 install --no-cache-dir torch==${TORCH_VERSION} --index-url https://download.pytorch.org/whl/cu121 && \
pip3 install --no-cache-dir xformers && \
deactivate
# Clone the git repo of Text Generation Web UI and set version
WORKDIR /
RUN git clone https://github.com/oobabooga/text-generation-webui && \
cd /text-generation-webui && \
git checkout ${OOBABOOGA_COMMIT}
# Install the dependencies for Text Generation Web UI
# Including all extensions
WORKDIR /text-generation-webui
RUN source /venv/bin/activate && \
pip3 install -r requirements.txt && \
bash -c 'for req in extensions/*/requirements.txt ; do pip3 install -r "$req" ; done' && \
mkdir -p repositories && \
cd repositories && \
git clone https://github.com/turboderp/exllama && \
pip3 install -r exllama/requirements.txt && \
deactivate
# Fix broken safetensors
RUN source /venv/bin/activate && \
pip3 install -U safetensors==0.4.1
# Install rclone
RUN curl https://rclone.org/install.sh | bash
# Install runpodctl
RUN wget https://github.com/runpod/runpodctl/releases/download/v1.10.0/runpodctl-linux-amd -O runpodctl && \
chmod a+x runpodctl && \
mv runpodctl /usr/local/bin
# Install croc
RUN curl https://getcroc.schollz.com | bash
# Install speedtest CLI
RUN curl -s https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.deb.sh | bash && \
apt install speedtest
# Install Jupyter
RUN pip3 install -U --no-cache-dir jupyterlab \
jupyterlab_widgets \
ipykernel \
ipywidgets \
gdown
# NGINX Proxy
COPY nginx/nginx.conf /etc/nginx/nginx.conf
COPY nginx/api.html nginx/502.html /usr/share/nginx/html/
COPY nginx/template-readme.md /usr/share/nginx/html/README.md
# Remove existing SSH host keys
RUN rm -f /etc/ssh/ssh_host_*
# Copy startup script for Oobabooba Web UI
COPY --chmod=755 scripts/start_textgen_server.sh /text-generation-webui/
# Copy scripts to download models
COPY fetch_model.py /text-generation-webui/
COPY download_model.py /text-generation-webui/
WORKDIR /
# Copy the scripts
COPY --chmod=755 scripts/* ./
# Start the container
ENV TEMPLATE_VERSION=1.11.1
SHELL ["/bin/bash", "--login", "-c"]
CMD [ "/start.sh" ]