Christoph Holthaus commited on
Commit
72249cb
·
1 Parent(s): 9b2ffc6

test dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +73 -0
Dockerfile ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Dockerfile to deploy a llama-cpp container with conda-ready environments
2
+
3
+ # docker pull continuumio/miniconda3:latest
4
+
5
+ ARG TAG=latest
6
+ FROM continuumio/miniconda3:$TAG
7
+
8
+ RUN apt-get update \
9
+ && DEBIAN_FRONTEND="noninteractive" apt-get install -y --no-install-recommends \
10
+ git \
11
+ locales \
12
+ sudo \
13
+ build-essential \
14
+ dpkg-dev \
15
+ wget \
16
+ openssh-server \
17
+ nano \
18
+ && rm -rf /var/lib/apt/lists/*
19
+
20
+ # Setting up locales
21
+
22
+ RUN locale-gen en_US.UTF-8
23
+ ENV LANG en_US.UTF-8
24
+
25
+ # SSH exposition
26
+
27
+ EXPOSE 22/tcp
28
+ RUN service ssh start
29
+
30
+ # Create user
31
+
32
+ RUN groupadd --gid 1020 llama-cpp-group
33
+ RUN useradd -rm -d /home/llama-cpp-user -s /bin/bash -G users,sudo,llama-cpp-group -u 1000 llama-cpp-user
34
+
35
+ # Update user password
36
+ RUN echo 'llama-cpp-user:admin' | chpasswd
37
+
38
+ # Updating conda to the latest version
39
+ RUN conda update conda -y
40
+
41
+ # Create virtalenv
42
+ RUN conda create -n llamacpp -y python=3.10.6
43
+
44
+ # Adding ownership of /opt/conda to $user
45
+ RUN chown -R llama-cpp-user:users /opt/conda
46
+
47
+ # conda init bash for $user
48
+ RUN su - llama-cpp-user -c "conda init bash"
49
+
50
+ # Download latest github/llama-cpp in llama.cpp directory and compile it
51
+ RUN su - llama-cpp-user -c "git clone https://github.com/ggerganov/llama.cpp.git ~/llama.cpp \
52
+ && cd ~/llama.cpp \
53
+ && make "
54
+
55
+ # Install Requirements for python virtualenv
56
+ RUN su - llama-cpp-user -c "cd ~/llama.cpp \
57
+ && conda activate llamacpp \
58
+ && python3 -m pip install -r requirements.txt "
59
+
60
+ # Download model
61
+ # RUN su - llama-cpp-user -c "https://github.com/facebookresearch/llama.git ~/llama \
62
+ # && cd ~/llama \
63
+ # && ./download.sh "
64
+
65
+ # COPY entrypoint.sh /usr/bin/entrypoint
66
+ # RUN chmod 755 /usr/bin/entrypoint
67
+ # ENTRYPOINT ["/usr/bin/entrypoint"]
68
+
69
+ # Preparing for login
70
+ ENV HOME /home/llama-cpp-user
71
+ WORKDIR ${HOME}/llama.cpp
72
+ USER llama-cpp-user
73
+ CMD ["/bin/bash"]