2023-09-26 14:48:34 -06:00
|
|
|
FROM nvidia/cuda:11.8.0-devel-ubuntu22.04 as build
|
|
|
|
|
2023-09-27 14:36:49 -06:00
|
|
|
RUN apt-get update && \
|
|
|
|
apt-get install -y git python3-pip python3-venv wget unzip && \
|
|
|
|
rm -rf /var/lib/apt/lists/*
|
2023-09-26 21:45:13 -06:00
|
|
|
RUN pip3 install --upgrade pip setuptools wheel
|
2023-09-26 14:48:34 -06:00
|
|
|
|
|
|
|
RUN git clone https://git.evulid.cc/cyberes/local-llm-server.git /local-llm-server
|
|
|
|
|
|
|
|
WORKDIR /local-llm-server
|
|
|
|
|
|
|
|
RUN python3 -m venv /venv
|
|
|
|
RUN /venv/bin/pip install git+https://github.com/vllm-project/vllm
|
|
|
|
|
2023-09-26 21:45:13 -06:00
|
|
|
RUN python3 -m venv /jupyterlab
|
|
|
|
RUN /jupyterlab/bin/pip install jupyterlab
|
|
|
|
RUN /jupyterlab/bin/jupyter labextension disable "@jupyterlab/apputils-extension:announcements"
|
2023-09-26 14:48:34 -06:00
|
|
|
|
|
|
|
RUN mkdir -p /app
|
|
|
|
RUN wget https://github.com/rapiz1/rathole/releases/download/v0.4.8/rathole-x86_64-unknown-linux-gnu.zip -O /tmp/rathole.zip
|
|
|
|
RUN unzip -j /tmp/rathole.zip -d /tmp
|
|
|
|
RUN rm /tmp/rathole.zip
|
|
|
|
RUN cp /tmp/rathole /app
|
|
|
|
|
2023-09-26 21:45:13 -06:00
|
|
|
# The local local-llm-server repo may be cached, so we will fetch and reset to the remote every time.
|
|
|
|
# Also, make sure there weren't any pip deps added.
|
|
|
|
ADD "https://www.random.org/cgi-bin/randbyte?nbytes=10&format=h" skipcache
|
|
|
|
RUN git fetch; git reset --hard origin/master
|
|
|
|
RUN /venv/bin/pip install -r requirements.txt
|
|
|
|
|
2023-09-26 14:48:34 -06:00
|
|
|
FROM nvidia/cuda:11.8.0-base-ubuntu22.04 as runtime
|
|
|
|
|
|
|
|
RUN apt-get update && apt-get install -y supervisor && rm -rf /var/lib/apt/lists/*
|
|
|
|
|
2023-09-26 21:45:13 -06:00
|
|
|
RUN useradd -ms /bin/bash apiserver
|
|
|
|
RUN usermod -s /bin/bash root
|
|
|
|
|
2023-09-27 14:36:49 -06:00
|
|
|
RUN apt-get update && \
|
|
|
|
apt-get install -y python3 python3-pip wget aria2 git-lfs git openssh-server openssh-client nano tmux && \
|
|
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
|
2023-09-26 21:45:13 -06:00
|
|
|
RUN pip3 install --upgrade pip setuptools wheel
|
|
|
|
RUN pip3 install glances
|
|
|
|
|
|
|
|
# Enable root SSH login
|
|
|
|
RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
|
|
|
|
|
|
|
|
# Disable password SSH login
|
|
|
|
RUN sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config
|
|
|
|
|
|
|
|
# Create the necessary directory for SSH
|
|
|
|
RUN mkdir /var/run/sshd
|
|
|
|
|
|
|
|
ADD "https://www.random.org/cgi-bin/randbyte?nbytes=10&format=h" skipcache
|
|
|
|
|
2023-09-26 14:48:34 -06:00
|
|
|
COPY --from=build /local-llm-server /local-llm-server
|
|
|
|
COPY --from=build /venv /venv
|
|
|
|
COPY --from=build /app /app
|
2023-09-26 21:45:13 -06:00
|
|
|
COPY --from=build /jupyterlab /jupyterlab
|
2023-09-26 14:48:34 -06:00
|
|
|
RUN cp /local-llm-server/other/vllm/Docker/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
|
|
|
|
2023-09-27 14:59:33 -06:00
|
|
|
RUN echo '' > /app/start-vllm.sh
|
2023-09-27 00:04:37 -06:00
|
|
|
|
2023-09-26 21:45:13 -06:00
|
|
|
COPY ./rathole-client.toml /app/client.toml
|
|
|
|
COPY ./jupyter /app/jupyter
|
|
|
|
COPY ./ssh /root/.ssh
|
2023-09-27 14:59:33 -06:00
|
|
|
COPY ./start-container.sh /app/start.sh
|
|
|
|
|
|
|
|
RUN mkdir -p /var/log/app/
|
2023-09-26 14:48:34 -06:00
|
|
|
|
2023-09-26 21:45:13 -06:00
|
|
|
RUN chown -R apiserver:apiserver /local-llm-server && \
|
2023-09-27 14:59:33 -06:00
|
|
|
chown -R apiserver:apiserver /app && \
|
|
|
|
chown -R apiserver:apiserver /var/log/app/
|
2023-09-26 14:48:34 -06:00
|
|
|
|
2023-09-26 21:45:13 -06:00
|
|
|
ENV SHELL="/bin/bash"
|
|
|
|
|
|
|
|
# SSH
|
|
|
|
EXPOSE 22
|
|
|
|
|
|
|
|
# VLLM
|
2023-09-26 14:48:34 -06:00
|
|
|
EXPOSE 7000
|
|
|
|
|
2023-09-26 21:45:13 -06:00
|
|
|
# Jupyter
|
|
|
|
EXPOSE 8888
|
|
|
|
|
2023-09-27 14:59:33 -06:00
|
|
|
CMD /app/start.sh
|