Skip to content

Commit cb4b886

Browse files
committed
update dockerfile
1 parent f5d1ab0 commit cb4b886

File tree

5 files changed

+62
-79
lines changed

5 files changed

+62
-79
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.venv/

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ comp/
186186
logs/
187187
tmpdata/
188188
slurm_run/
189+
env/apt/
189190
data
190191
playground
191192
log_reload.py

README.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -85,22 +85,21 @@ The envionment of this version has been updated to accommodate more latest model
8585
- Commands to install environment
8686
```shell
8787
# Note:
88-
# [code] is an `absolute path` of project root: abspath(./)
89-
# [data] and [playground] are `absolute paths` of data and model_playground(decompress our provided data/playground).
88+
# [data] is the `absolute paths` of data.
9089
91-
docker build -t multitrust:v0.0.1 -f env/Dockerfile .
90+
cp -r /etc/apt ./env/apt
91+
92+
docker build --network=host -t multitrust:v0.0.1 -f env/Dockerfile .
9293
9394
docker run -it \
9495
--name multitrust \
9596
--gpus all \
9697
--privileged=true \
9798
--shm-size=10gb \
98-
-v /home/[your_user_name_here]/.cache/huggingface:/root/.cache/huggingface \
99-
-v /home/[your_user_name_here]/.cache/torch:/root/.cache/torch \
100-
-v [code]:/root/multitrust \
101-
-v [data]:/root/multitrust/data \
102-
-v [playground]:/root/multitrust/playground \
103-
-w /root/multitrust \
99+
-v $HOME/.cache/huggingface:/root/.cache/huggingface \
100+
-v $HOME/.cache/torch:/root/.cache/torch \
101+
-v [data]:/root/MMTrustEval/data \
102+
-w /root/MMTrustEval \
104103
-p 11180:22 \
105104
-p 8000:8000 \
106105
-d multitrust:v0.0.1 /bin/bash

env/Dockerfile

Lines changed: 52 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,64 @@
1-
FROM ubuntu:22.04
1+
FROM nvidia/cuda:12.4.0-devel-ubuntu22.04
2+
3+
# Set environment variable
24
ENV DEBIAN_FRONTEND=noninteractive
35
ENV CRYPTOGRAPHY_DONT_BUILD_RUST=1
46
ENV LD_LIBRARY_PATH=/usr/local/cuda/lib64
5-
ENV PATH=/usr/local/cuda/bin:${PATH}
6-
ENV PATH=/root/miniconda3/bin:${PATH}
7-
# ENV http_proxy=http://your_proxy_here \
8-
# https_proxy=http://your_proxy_here
7+
ENV PATH=/usr/local/cuda/bin:/root/miniconda3/bin:${PATH}
98

10-
WORKDIR /root/
9+
# Copy the configuration file
10+
COPY env/apt /etc/apt
11+
COPY . /root/MMTrustEval
1112

12-
COPY ./env/sources.list /etc/apt/sources.list
13-
COPY ./env/requirements.txt /root/requirements.txt
13+
WORKDIR /root/MMTrustEval
1414

1515
SHELL ["/bin/bash", "--login", "-c"]
1616

17+
# System package installation and basic configuration
1718
RUN apt-get clean all \
19+
&& rm -rf /var/lib/apt/lists/* \
1820
&& apt-get update -y \
19-
&& apt-get install -y apt-utils rsync openssh-server inetutils-ping wget curl sudo git zip unzip vim \
20-
&& apt-get install -y libgl1 gcc g++ build-essential pkg-config libssl-dev \
21-
&& /etc/init.d/ssh start \
21+
&& apt-get install -y --no-install-recommends \
22+
apt-utils \
23+
rsync \
24+
openssh-server \
25+
inetutils-ping \
26+
wget \
27+
curl \
28+
sudo \
29+
git \
30+
zip \
31+
unzip \
32+
vim \
33+
libgl1 \
34+
gcc \
35+
g++ \
36+
build-essential \
37+
pkg-config \
38+
libssl-dev \
39+
ca-certificates \
40+
python3.9 \
41+
&& rm -rf /var/lib/apt/lists/*
42+
43+
# SSH configuration
44+
RUN /etc/init.d/ssh start \
2245
&& echo "PermitRootLogin yes" >> /etc/ssh/sshd_config \
2346
&& echo 'root:123456' | chpasswd \
24-
&& service ssh restart \
25-
&& mkdir -p ~/miniconda3 \
26-
&& wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /root/miniconda3/miniconda.sh \
27-
&& bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3 \
28-
&& rm -rf ~/miniconda3/miniconda.sh \
29-
&& /root/miniconda3/bin/conda init bash \
30-
&& curl https://sh.rustup.rs -sSf | sh -s -- -y \
31-
&& bash -l -c "source /root/.bashrc" \
32-
&& conda install python=3.9 -y \
33-
&& wget https://developer.download.nvidia.com/compute/cuda/12.4.0/local_installers/cuda_12.4.0_550.54.14_linux.run -O /root/cuda.run \
34-
&& bash /root/cuda.run --silent --toolkit --override \
35-
&& rm -f /root/cuda.run \
36-
&& pip install -r /root/requirements.txt
37-
38-
# for ssh login
39-
EXPOSE 22
40-
# for mkdocs service
41-
EXPOSE 8000
47+
&& service ssh restart
48+
49+
50+
# UV
51+
RUN wget -qO- https://astral.sh/uv/install.sh | sh \
52+
&& source $HOME/.local/bin/env \
53+
&& uv venv --python 3.9 \
54+
&& source .venv/bin/activate \
55+
&& uv pip install setuptools \
56+
&& uv pip install torch==2.3.0 \
57+
&& uv pip sync --no-build-isolation ./env/requirements.txt
58+
59+
60+
# Port
61+
EXPOSE 22 8000
62+
63+
# SSH
64+
CMD ["/usr/sbin/sshd", "-D"]

env/sources.list

Lines changed: 0 additions & 41 deletions
This file was deleted.

0 commit comments

Comments
 (0)