kwabs22 commited on
Commit
fbf941a
1 Parent(s): f5daf13

Testing Stable LM 2 1.6B Zephyr

Browse files
Files changed (1) hide show
  1. Dockerfile +36 -28
Dockerfile CHANGED
@@ -1,40 +1,48 @@
1
- # Use an official Python runtime as a parent image
2
- FROM python:3.8-slim
3
 
4
- # Set the working directory in the container
5
- WORKDIR /usr/src/app
6
 
7
  # Install system dependencies
8
  RUN apt-get update && apt-get install -y \
9
- wget \
10
- git \
11
- build-essential
12
-
13
- # Clone llama.cpp
14
- RUN git clone https://github.com/ggerganov/llama.cpp.git
15
-
16
- # Download the model
17
- RUN cd llama.cpp/models && \
18
  wget -O stablelm-2-zephyr-1_6b-Q4_0.gguf https://huggingface.co/stabilityai/stablelm-2-zephyr-1_6b/resolve/main/stablelm-2-zephyr-1_6b-Q4_0.gguf?download=true
19
-
20
- # Build llama.cpp
21
- RUN cd llama.cpp && \
22
  make -j
23
 
24
- # Set MPLCONFIGDIR to a writable directory
25
- ENV MPLCONFIGDIR /usr/src/app/flagged
 
 
 
26
 
27
- # Make sure the directory exists and has proper permissions
28
- RUN mkdir -p $MPLCONFIGDIR && chmod -R 777 $MPLCONFIGDIR
29
 
30
- # Copy the current directory contents into the container at /usr/src/app
31
- COPY . .
 
 
 
 
 
 
 
 
 
 
 
 
32
 
33
- # Install any needed packages specified in requirements.txt
34
- RUN pip install --no-cache-dir -r requirements.txt
35
 
36
- # Make port 7860 available to the world outside this container
37
- EXPOSE 7860
38
 
39
- # Run app.py when the container launches
40
- CMD ["python", "./app.py"]
 
1
+ FROM python:3.9
 
2
 
3
+ WORKDIR /app
 
4
 
5
  # Install system dependencies
6
  RUN apt-get update && apt-get install -y \
7
+ git \
8
+ build-essential \
9
+ wget \
10
+ && rm -rf /var/lib/apt/lists/*
11
+
12
+ # Clone llama.cpp and build it
13
+ RUN git clone https://github.com/ggerganov/llama.cpp.git /app/llama.cpp
14
+ RUN cd /app/llama.cpp/models && \
 
15
  wget -O stablelm-2-zephyr-1_6b-Q4_0.gguf https://huggingface.co/stabilityai/stablelm-2-zephyr-1_6b/resolve/main/stablelm-2-zephyr-1_6b-Q4_0.gguf?download=true
16
+ RUN cd /app/llama.cpp && \
 
 
17
  make -j
18
 
19
+ # Create a virtual environment and activate it
20
+ RUN python -m venv /opt/venv
21
+ ENV PATH="/opt/venv/bin:$PATH"
22
+
23
+ COPY ./requirements.txt /app/requirements.txt
24
 
25
+ RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt
 
26
 
27
+ # Set up a new user named "user" with user ID 1000
28
+ RUN useradd -m -u 1000 user
29
+ # Switch to the "user" user
30
+ USER user
31
+ # Set home to the user's home directory
32
+ ENV HOME=/home/user \
33
+ PATH=/home/user/.local/bin:$PATH \
34
+ PYTHONPATH=$HOME/app \
35
+ PYTHONUNBUFFERED=1 \
36
+ GRADIO_ALLOW_FLAGGING=never \
37
+ GRADIO_NUM_PORTS=1 \
38
+ GRADIO_SERVER_NAME=0.0.0.0 \
39
+ GRADIO_THEME=huggingface \
40
+ SYSTEM=spaces
41
 
42
+ # Set the working directory to the user's home directory
43
+ WORKDIR $HOME/app
44
 
45
+ # Copy the current directory contents into the container at $HOME/app setting the owner to the user
46
+ COPY --chown=user . $HOME/app
47
 
48
+ CMD ["python", "app.py"]