Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +26 -8
Dockerfile
CHANGED
@@ -1,4 +1,21 @@
|
|
1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
ENV DEBIAN_FRONTEND=noninteractive \
|
4 |
TZ=Asia/Jakarta
|
@@ -21,8 +38,7 @@ RUN rm -f /etc/apt/sources.list.d/*.list && \
|
|
21 |
build-essential \
|
22 |
libsndfile-dev \
|
23 |
software-properties-common \
|
24 |
-
openssh-client
|
25 |
-
&& rm -rf /var/lib/apt/lists/*
|
26 |
|
27 |
RUN add-apt-repository ppa:flexiondotorg/nvtop && \
|
28 |
apt-get upgrade -y && \
|
@@ -34,6 +50,9 @@ RUN curl -fsSL https://tailscale.com/install.sh | sh
|
|
34 |
# Create a working directory
|
35 |
WORKDIR /app
|
36 |
|
|
|
|
|
|
|
37 |
# Create a non-root user and switch to it
|
38 |
RUN adduser --disabled-password --gecos '' --shell /bin/bash user \
|
39 |
&& chown -R user:user /app
|
@@ -48,7 +67,7 @@ RUN mkdir $HOME/.cache $HOME/.config \
|
|
48 |
# Set up the Conda environment
|
49 |
ENV CONDA_AUTO_UPDATE_CONDA=false \
|
50 |
PATH=$HOME/miniconda/bin:$PATH
|
51 |
-
RUN curl -sLo ~/miniconda.sh https://repo.
|
52 |
&& chmod +x ~/miniconda.sh \
|
53 |
&& ~/miniconda.sh -b -p ~/miniconda \
|
54 |
&& rm ~/miniconda.sh \
|
@@ -66,8 +85,7 @@ USER root
|
|
66 |
## Security warning : Potential user code executed as root (build time)
|
67 |
RUN --mount=target=/root/packages.txt,source=packages.txt \
|
68 |
apt-get update && \
|
69 |
-
xargs -r -a /root/packages.txt apt-get install -y --no-install-recommends
|
70 |
-
&& rm -rf /var/lib/apt/lists/*
|
71 |
|
72 |
RUN --mount=target=/root/on_startup.sh,source=on_startup.sh,readwrite \
|
73 |
bash /root/on_startup.sh
|
@@ -89,7 +107,7 @@ COPY --chown=user . $HOME/app
|
|
89 |
|
90 |
RUN chmod +x start_server.sh
|
91 |
|
92 |
-
COPY --chown=user login.html /home/user/miniconda/lib/python3.
|
93 |
|
94 |
ENV PYTHONUNBUFFERED=1 \
|
95 |
GRADIO_ALLOW_FLAGGING=never \
|
@@ -99,4 +117,4 @@ ENV PYTHONUNBUFFERED=1 \
|
|
99 |
SYSTEM=spaces \
|
100 |
SHELL=/bin/bash
|
101 |
|
102 |
-
CMD ["./start_server.sh"]
|
|
|
1 |
+
ARG UBUNTU_VERSION=22.04
|
2 |
+
ARG CUDA_VERSION=12.2.2
|
3 |
+
ARG CUDA_DOCKER_ARCH=all
|
4 |
+
|
5 |
+
FROM nvidia/cuda:${CUDA_VERSION}-devel-ubuntu${UBUNTU_VERSION} as builder
|
6 |
+
|
7 |
+
RUN apt update && apt install git build-essential libopenblas-dev wget python3-pip pkg-config libcurl4-openssl-dev -y
|
8 |
+
RUN mkdir /opt/koboldcpp && mkdir /opt/llamacpp
|
9 |
+
RUN git clone https://github.com/lostruins/koboldcpp /opt/koboldcpp && git clone https://github.com/ggerganov/llama.cpp /opt/llamacpp
|
10 |
+
|
11 |
+
WORKDIR /opt/llamacpp
|
12 |
+
RUN make LLAMA_OPENBLAS=1 LLAMA_CUDA=1
|
13 |
+
|
14 |
+
WORKDIR /opt/koboldcpp
|
15 |
+
RUN make LLAMA_OPENBLAS=1 LLAMA_CUBLAS=1 LLAMA_PORTABLE=1
|
16 |
+
|
17 |
+
|
18 |
+
FROM nvidia/cuda:${CUDA_VERSION}-devel-ubuntu${UBUNTU_VERSION} as final
|
19 |
|
20 |
ENV DEBIAN_FRONTEND=noninteractive \
|
21 |
TZ=Asia/Jakarta
|
|
|
38 |
build-essential \
|
39 |
libsndfile-dev \
|
40 |
software-properties-common \
|
41 |
+
openssh-client
|
|
|
42 |
|
43 |
RUN add-apt-repository ppa:flexiondotorg/nvtop && \
|
44 |
apt-get upgrade -y && \
|
|
|
50 |
# Create a working directory
|
51 |
WORKDIR /app
|
52 |
|
53 |
+
COPY --from=builder /opt/koboldcpp /app/koboldcpp
|
54 |
+
COPY --from=builder /opt/llamacpp /app/llama.cpp
|
55 |
+
|
56 |
# Create a non-root user and switch to it
|
57 |
RUN adduser --disabled-password --gecos '' --shell /bin/bash user \
|
58 |
&& chown -R user:user /app
|
|
|
67 |
# Set up the Conda environment
|
68 |
ENV CONDA_AUTO_UPDATE_CONDA=false \
|
69 |
PATH=$HOME/miniconda/bin:$PATH
|
70 |
+
RUN curl -sLo ~/miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-py311_24.3.0-0-Linux-x86_64.sh \
|
71 |
&& chmod +x ~/miniconda.sh \
|
72 |
&& ~/miniconda.sh -b -p ~/miniconda \
|
73 |
&& rm ~/miniconda.sh \
|
|
|
85 |
## Security warning : Potential user code executed as root (build time)
|
86 |
RUN --mount=target=/root/packages.txt,source=packages.txt \
|
87 |
apt-get update && \
|
88 |
+
xargs -r -a /root/packages.txt apt-get install -y --no-install-recommends
|
|
|
89 |
|
90 |
RUN --mount=target=/root/on_startup.sh,source=on_startup.sh,readwrite \
|
91 |
bash /root/on_startup.sh
|
|
|
107 |
|
108 |
RUN chmod +x start_server.sh
|
109 |
|
110 |
+
COPY --chown=user login.html /home/user/miniconda/lib/python3.11/site-packages/jupyter_server/templates/login.html
|
111 |
|
112 |
ENV PYTHONUNBUFFERED=1 \
|
113 |
GRADIO_ALLOW_FLAGGING=never \
|
|
|
117 |
SYSTEM=spaces \
|
118 |
SHELL=/bin/bash
|
119 |
|
120 |
+
CMD ["./start_server.sh"]
|