Spaces:
Running
Running
MVPilgrim
commited on
Commit
·
76b7f75
1
Parent(s):
8e3b00b
debug
Browse files- Dockerfile +28 -67
Dockerfile
CHANGED
@@ -1,80 +1,41 @@
|
|
1 |
-
#
|
2 |
-
FROM
|
3 |
|
|
|
4 |
RUN apt-get update && apt-get install -y \
|
5 |
-
|
6 |
-
python3 \
|
7 |
-
python3.11 \
|
8 |
-
python3-pip \
|
9 |
-
cmake \
|
10 |
wget \
|
|
|
|
|
|
|
11 |
&& rm -rf /var/lib/apt/lists/*
|
12 |
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
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 |
-
#
|
38 |
-
|
39 |
-
|
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 |
-
#
|
59 |
-
|
60 |
-
|
61 |
|
62 |
-
#
|
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 |
-
|
|
|
77 |
|
|
|
|
|
78 |
|
79 |
-
#
|
80 |
-
CMD ["
|
|
|
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"]
|