forked from vectorch-ai/ScaleLLM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
80 lines (62 loc) · 1.77 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
# set base image using nvidia cuda 12.1 for ubuntu 22.04
ARG BASE_IMAGE=nvcr.io/nvidia/cuda:12.1.0-devel-ubuntu22.04
# ---- Build ----
FROM $BASE_IMAGE as build
LABEL maintainer="[email protected]"
# install build tools
RUN apt-get update -q -y && \
apt-get install -q -y \
build-essential \
ninja-build \
cmake \
ccache \
python3-dev \
zip \
pkg-config \
libssl-dev \
libboost-all-dev \
curl \
git \
wget
# install jemalloc (optional)
RUN cd /tmp && \
wget -nc --no-check-certificate https://github.com/jemalloc/jemalloc/releases/download/5.3.0/jemalloc-5.3.0.tar.bz2 && \
tar -xvf jemalloc-5.3.0.tar.bz2 && \
(cd jemalloc-5.3.0 && \
./configure --enable-prof --disable-initial-exec-tls && \
make -j$(nproc) && make install && \
ldconfig)
# install rust
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
ENV PATH=$HOME/.cargo/bin:$PATH
WORKDIR /ScaleLLM
# copy code from host to container
COPY ./ ./
# build
RUN cmake -G Ninja -S . -B build
RUN cmake --build build --target scalellm --config Release -j$(nproc)
# install
RUN cmake --install build --prefix /app
RUN cp ./scripts/download_hf_models.py /app/download_hf_models.py
RUN cp ./scripts/entrypoint.sh /app/entrypoint.sh
RUN cp ./requirements.txt /app/requirements.txt
# ---- Production ----
FROM ubuntu:22.04 as runtime
WORKDIR /app
# copy artifacts from build
COPY --from=build /app ./
# install python3 and pip3
RUN apt-get update -q -y && \
apt-get install -q -y \
python3 \
python3-pip && \
apt-get -y autoremove && \
apt-get clean
# install python dependencies
RUN pip3 install -r ./requirements.txt
# expose port for grpc
EXPOSE 8888
# expose port for http
EXPOSE 9999
# start the server
ENTRYPOINT [ "/app/entrypoint.sh" ]