MVPilgrim commited on
Commit
76b7f75
·
1 Parent(s): 8e3b00b
Files changed (1) hide show
  1. Dockerfile +28 -67
Dockerfile CHANGED
@@ -1,80 +1,41 @@
1
- # Stage 1: Build dependencies
2
- FROM debian:latest as builder
3
 
 
4
  RUN apt-get update && apt-get install -y \
5
- musl \
6
- python3 \
7
- python3.11 \
8
- python3-pip \
9
- cmake \
10
  wget \
 
 
 
11
  && rm -rf /var/lib/apt/lists/*
12
 
13
- WORKDIR /app
14
-
15
- COPY ./requirements.txt /app/requirements.txt
16
- RUN pip3 install --break-system-packages --no-cache-dir --upgrade -r /app/requirements.txt
17
- RUN pip3 install --break-system-packages https://files.pythonhosted.org/packages/13/87/e0cb08c2d4bd7d38ab63816b306c8b1e7cfdc0e59bd54462e8b0df069078/semantic_text_splitter-0.6.3-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
18
- RUN pip3 install --break-system-packages llama_cpp_python
19
- RUN FORCE_CMAKE=1 CMAKE_SYSTEM_PROCESSOR=AMD64 pip3 install --break-system-packages --verbose --no-cache-dir llama-cpp-python --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu
20
-
21
- # Install text2vec-transformers
22
- WORKDIR /app/text2vec-transformers
23
- COPY --from=semitechnologies/transformers-inference:sentence-transformers-multi-qa-MiniLM-L6-cos-v1 /app /app/text2vec-transformers
24
- COPY --from=semitechnologies/transformers-inference:sentence-transformers-multi-qa-MiniLM-L6-cos-v1 /usr/local/bin /app/text2vec-transformers/bin
25
- COPY ./multi-qa-MiniLM-L6-cos-v1 /app/text2vec-transformers
26
- RUN ./custom_prerequisites.py
27
-
28
- # Stage 2: Final image
29
- FROM nvidia/cuda:12.6.0-cudnn-runtime-ubuntu24.04 as final
30
-
31
- RUN apt-get update && apt-get install -y \
32
- wget \
33
- curl \
34
- unzip \
35
  && rm -rf /var/lib/apt/lists/*
36
 
37
- # Copy Python environment from builder stage
38
- COPY --from=builder /usr/local /usr/local
39
- COPY --from=builder /app /app
40
-
41
- # Set up environment variables
42
- ENV LD_LIBRARY_PATH="/usr/lib/x86_64-linux-gnu:/usr/local/cuda/lib64:$LD_LIBRARY_PATH"
43
- ENV PATH="/app:/app/text2vec-transformers:/app/text2vec-transformers/bin:/usr/local/bin:$PATH"
44
-
45
- WORKDIR /app
46
-
47
- # Copy application files
48
- COPY ./semsearch.py /app/semsearch.py
49
- COPY ./startup.sh /app/startup.sh
50
- COPY ./.streamlit/main.css /app/.streamlit/main.css
51
- COPY ./app.py /app/app.py
52
- RUN chmod 755 /app/startup.sh
53
-
54
- # Copy input documents
55
- RUN mkdir -p /app/inputDocs
56
- COPY ./inputDocs/* /app/inputDocs/
57
 
58
- # Install Weaviate
59
- WORKDIR /app/weaviate
60
- RUN wget -qO- https://github.com/weaviate/weaviate/releases/download/v1.24.10/weaviate-v1.24.10-linux-amd64.tar.gz | tar -xzf -
61
 
62
- # Download Llama model
63
  WORKDIR /app
64
- RUN wget -v https://huggingface.co/TheBloke/Llama-2-7B-Chat-GGUF/resolve/main/llama-2-7b-chat.Q4_0.gguf
65
-
66
- # Create a non-root user
67
- RUN groupadd -g 2222 user && useradd -m -u 2222 -g user user
68
-
69
- # Set permissions
70
- RUN chown -R user:user /app
71
- RUN chmod -R 755 /app
72
-
73
- # Switch to non-root user
74
- USER user
75
 
76
- EXPOSE 8080 8501
 
77
 
 
 
78
 
79
- #CMD ["streamlit", "run", "/app/app.py", "--server.headless", "true", "--server.enableCORS", "false", "--server.enableXsrfProtection", "false", "--server.fileWatcherType", "none"]
80
- CMD ["/app/delay.sh", "1200"]
 
1
+ # Start with NVIDIA CUDA 12.6 base image
2
+ FROM nvidia/cuda:12.6.0-base-ubuntu22.04 AS base
3
 
4
+ # Install necessary dependencies and musl
5
  RUN apt-get update && apt-get install -y \
6
+ software-properties-common \
 
 
 
 
7
  wget \
8
+ musl \
9
+ musl-dev \
10
+ musl-tools \
11
  && rm -rf /var/lib/apt/lists/*
12
 
13
+ # Install Python 3.11
14
+ RUN add-apt-repository ppa:deadsnakes/ppa && \
15
+ apt-get update && \
16
+ apt-get install -y \
17
+ python3.11 \
18
+ python3.11-venv \
19
+ python3.11-dev \
20
+ python3-pip \
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  && rm -rf /var/lib/apt/lists/*
22
 
23
+ # Set Python 3.11 as the default python version
24
+ RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 1
25
+ RUN update-alternatives --set python3 /usr/bin/python3.11
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
 
27
+ # Verify Python and musl installations
28
+ RUN python3 --version && \
29
+ ldd --version | grep musl
30
 
31
+ # Set up a working directory
32
  WORKDIR /app
 
 
 
 
 
 
 
 
 
 
 
33
 
34
+ # Copy your application files
35
+ COPY . /app
36
 
37
+ # Install any needed packages specified in requirements.txt
38
+ RUN pip3 install --no-cache-dir -r requirements.txt
39
 
40
+ # Command to run the application
41
+ CMD ["python3xxx", "app.py"]