binary1ne commited on
Commit
932a3f7
·
verified ·
1 Parent(s): 455791d

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +93 -16
Dockerfile CHANGED
@@ -1,21 +1,98 @@
1
- FROM nvidia/cuda:12.1.105-devel-ubuntu22.04
2
 
3
- # Install Python & dependencies
4
- RUN apt-get update && apt-get install -y python3 python3-pip git && \
5
- rm -rf /var/lib/apt/lists/*
6
 
7
- # Create default user to fix getpwuid() error
8
- RUN echo "user:x:1000:1000::/home/user:/bin/bash" >> /etc/passwd && \
9
- mkdir -p /home/user && chown -R 1000:1000 /home/user
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
 
11
- # Install vLLM
12
- RUN pip install --upgrade pip && \
13
- pip install vllm
14
 
15
- # Expose API port
16
- EXPOSE 8000
 
17
 
18
- # Run vLLM serving
19
- CMD ["python3", "-m", "vllm.entrypoints.openai.api_server", \
20
- "--model", "unsloth/llama-2-7b-bnb-4bit", \
21
- "--host", "0.0.0.0", "--port", "8000"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM nvidia/cuda:12.5.1-cudnn-devel-ubuntu20.04
2
 
3
+ ENV DEBIAN_FRONTEND=noninteractive \
4
+ TZ=Asia/Kolkata
 
5
 
6
+ # Remove any third-party apt sources to avoid issues with expiring keys.
7
+ RUN rm -f /etc/apt/sources.list.d/*.list && \
8
+ apt-get update && apt-get install -y --no-install-recommends \
9
+ curl \
10
+ ca-certificates \
11
+ sudo \
12
+ git \
13
+ wget \
14
+ procps \
15
+ git-lfs \
16
+ zip \
17
+ unzip \
18
+ htop \
19
+ vim \
20
+ nano \
21
+ bzip2 \
22
+ libx11-6 \
23
+ build-essential \
24
+ libsndfile-dev \
25
+ software-properties-common \
26
+ && rm -rf /var/lib/apt/lists/*
27
 
28
+ RUN add-apt-repository ppa:flexiondotorg/nvtop && \
29
+ apt-get upgrade -y && \
30
+ apt-get install -y --no-install-recommends nvtop
31
 
32
+ RUN curl -sL https://deb.nodesource.com/setup_21.x | bash - && \
33
+ apt-get install -y nodejs && \
34
+ npm install -g configurable-http-proxy
35
 
36
+ # Create a working directory
37
+ WORKDIR /app
38
+
39
+ # Create non-root user
40
+ RUN adduser --disabled-password --gecos '' --shell /bin/bash user \
41
+ && chown -R user:user /app
42
+ RUN echo "user ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/90-user
43
+ USER user
44
+
45
+ ENV HOME=/home/user
46
+ RUN mkdir $HOME/.cache $HOME/.config \
47
+ && chmod -R 777 $HOME
48
+
49
+ # Install Miniconda
50
+ ENV CONDA_AUTO_UPDATE_CONDA=false \
51
+ PATH=$HOME/miniconda/bin:$PATH
52
+ RUN curl -sLo ~/miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-py39_4.10.3-Linux-x86_64.sh \
53
+ && chmod +x ~/miniconda.sh \
54
+ && ~/miniconda.sh -b -p ~/miniconda \
55
+ && rm ~/miniconda.sh \
56
+ && conda clean -ya
57
+
58
+ WORKDIR $HOME/app
59
+
60
+ #######################################
61
+ # Root section
62
+ #######################################
63
+ USER root
64
+
65
+ # Optional extra packages
66
+ RUN apt-get update && apt-get install -y --no-install-recommends \
67
+ python3-dev python3-pip python3-venv \
68
+ && rm -rf /var/lib/apt/lists/*
69
+
70
+ RUN mkdir /data && chown user:user /data
71
+
72
+ #######################################
73
+ # End root section
74
+ #######################################
75
+ USER user
76
+
77
+ # Install Python requirements for vLLM
78
+ RUN pip install --no-cache-dir --upgrade pip && \
79
+ pip install --no-cache-dir vllm
80
+
81
+ # Download model at build time (optional)
82
+ RUN python3 -m vllm.entrypoints.api_server --model unsloth/llama-2-7b-bnb-4bit --download-only
83
+
84
+ # Copy source code
85
+ COPY --chown=user . $HOME/app
86
+
87
+ RUN chmod +x start_server.sh
88
+
89
+ # Set env for vLLM
90
+ ENV PYTHONUNBUFFERED=1 \
91
+ VLLM_HOST=0.0.0.0 \
92
+ VLLM_PORT=7860
93
+
94
+ # Expose port
95
+ EXPOSE 7860
96
+
97
+ # Start vLLM API server
98
+ CMD ["python3", "-m", "vllm.entrypoints.api_server", "--model", "unsloth/llama-2-7b-bnb-4bit", "--host", "0.0.0.0", "--port", "7860"]