docker: clean up
This commit is contained in:
parent
21ff182ec1
commit
c222f96f24
|
@ -18,6 +18,8 @@ RUN rm /tmp/rathole.zip
|
||||||
RUN cp /tmp/rathole /app
|
RUN cp /tmp/rathole /app
|
||||||
|
|
||||||
RUN python3 -m venv /venv
|
RUN python3 -m venv /venv
|
||||||
|
RUN /venv/bin/pip3 install --upgrade pip setuptools wheel
|
||||||
|
RUN /venv/bin/pip3 install -r requirements.txt
|
||||||
|
|
||||||
# Install PyTorch before installing VLLM in an attempt to ensure we use the right
|
# Install PyTorch before installing VLLM in an attempt to ensure we use the right
|
||||||
# version for our CUDA install. (VLLM wants 2.0.1)
|
# version for our CUDA install. (VLLM wants 2.0.1)
|
||||||
|
@ -30,12 +32,6 @@ WORKDIR /local-llm-server
|
||||||
# ADD "https://www.random.org/cgi-bin/randbyte?nbytes=10&format=h" skipcache
|
# ADD "https://www.random.org/cgi-bin/randbyte?nbytes=10&format=h" skipcache
|
||||||
RUN /venv/bin/pip install git+https://github.com/vllm-project/vllm
|
RUN /venv/bin/pip install git+https://github.com/vllm-project/vllm
|
||||||
|
|
||||||
# Uninstall PyTorch since VLLM may have installed a version that is incompatible with
|
|
||||||
# our CUDA version.
|
|
||||||
RUN /venv/bin/pip3 uninstall -y torch
|
|
||||||
RUN /venv/bin/pip3 install torch==2.0.1 --index-url https://download.pytorch.org/whl/cu118
|
|
||||||
|
|
||||||
|
|
||||||
FROM nvidia/cuda:11.8.0-base-ubuntu22.04 as runtime
|
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/*
|
RUN apt-get update && apt-get install -y supervisor && rm -rf /var/lib/apt/lists/*
|
||||||
|
@ -43,19 +39,22 @@ RUN apt-get update && apt-get install -y supervisor && rm -rf /var/lib/apt/lists
|
||||||
RUN useradd -ms /bin/bash apiserver
|
RUN useradd -ms /bin/bash apiserver
|
||||||
RUN usermod -s /bin/bash root
|
RUN usermod -s /bin/bash root
|
||||||
|
|
||||||
|
# Required packages
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get install -y python3 python3-pip wget aria2 git-lfs git openssh-server openssh-client nano tmux file && \
|
apt-get install -y python3 python3-pip
|
||||||
rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
RUN pip3 install --upgrade pip setuptools wheel
|
RUN pip3 install --upgrade pip setuptools wheel
|
||||||
|
|
||||||
|
# Useful Python packages
|
||||||
RUN pip3 install glances
|
RUN pip3 install glances
|
||||||
|
|
||||||
|
# Useful tools
|
||||||
|
RUN apt-get install -y wget aria2 git-lfs git openssh-server openssh-client nano tmux file && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Enable root SSH login
|
# Enable root SSH login
|
||||||
RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
|
RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
|
||||||
|
|
||||||
# Disable password SSH login
|
# Disable password SSH login
|
||||||
RUN sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config
|
RUN sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config
|
||||||
|
|
||||||
# Create the necessary directory for sshd
|
# Create the necessary directory for sshd
|
||||||
RUN mkdir /var/run/sshd
|
RUN mkdir /var/run/sshd
|
||||||
|
|
||||||
|
|
|
@ -33,3 +33,17 @@ You **must** have a GPU attached to your system when building the container (req
|
||||||
2. `sudo docker build .`
|
2. `sudo docker build .`
|
||||||
If you want to build the latest VLLM, add `--no-cache`
|
If you want to build the latest VLLM, add `--no-cache`
|
||||||
Don't forget about `--progress=plain`
|
Don't forget about `--progress=plain`
|
||||||
|
|
||||||
|
To run the container on your local machine:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo docker run -it --shm-size 14g --gpus all -v /home/user/testing123/notebooks:/notebooks -v /home/user/testing123/storage:/storage -p 8888:8888 cyberes/vllm-paperspace:latest
|
||||||
|
```
|
||||||
|
|
||||||
|
You will need to create a directory to mount inside the container (for example: `/home/user/testing123/`). Within this should be the folder `models` that holds the model to load, `rathole-client.toml`, and `cmd.txt`.
|
||||||
|
|
||||||
|
If you need to debug something you can start a shell inside the container:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo docker run -it --shm-size 14g --gpus all -v /home/user/testing123/notebooks:/notebooks -v /home/user/testing123/storage:/storage -p 8888:8888 --entrypoint bash cyberes/vllm-paperspace:latest
|
||||||
|
```
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Build and push the container.
|
||||||
|
|
||||||
|
git pull; git pull; sudo docker build . -t cyberes/vllm-paperspace && sudo docker push cyberes/vllm-paperspace:latest
|
|
@ -1,12 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Update the container repository and make sure pip dependancies are up to date.
|
|
||||||
echo "UPDATING CONTAINER..."
|
|
||||||
cd /local-llm-server || exit
|
|
||||||
git fetch
|
|
||||||
git reset --hard origin/master
|
|
||||||
/venv/bin/pip install -r requirements.txt
|
|
||||||
|
|
||||||
# Create the required directories and files.
|
# Create the required directories and files.
|
||||||
echo "SETTING UP FILE SYSTEM..."
|
echo "SETTING UP FILE SYSTEM..."
|
||||||
mkdir -p /storage/vllm/
|
mkdir -p /storage/vllm/
|
||||||
|
|
|
@ -25,7 +25,7 @@ user=apiserver
|
||||||
environment=HOME="/home/apiserver",USER="apiserver"
|
environment=HOME="/home/apiserver",USER="apiserver"
|
||||||
|
|
||||||
[program:jupyter]
|
[program:jupyter]
|
||||||
command=/jupyterlab/bin/jupyter lab --no-browser --allow-root --ip=0.0.0.0 --LabApp.trust_xheaders=True --LabApp.disable_check_xsrf=False --LabApp.allow_remote_access=True --LabApp.allow_origin='*'
|
command=/jupyterlab/bin/jupyter lab --no-browser --allow-root --ip 0.0.0.0 --port 8888 --LabApp.trust_xheaders=True --LabApp.disable_check_xsrf=False --LabApp.allow_remote_access=True --LabApp.allow_origin='*'
|
||||||
environment=SHELL="/bin/bash"
|
environment=SHELL="/bin/bash"
|
||||||
autostart=true
|
autostart=true
|
||||||
autorestart=true
|
autorestart=true
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Run this script to update the container.
|
||||||
|
# Will restart VLLM as well.
|
||||||
|
|
||||||
|
cd /local-llm-server || exit
|
||||||
|
|
||||||
|
git fetch
|
||||||
|
git reset --hard origin/master
|
||||||
|
|
||||||
|
/venv/bin/pip install -r requirements.txt
|
||||||
|
|
||||||
|
supervisorctl restart vllm
|
Reference in New Issue