Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +39 -16
Dockerfile
CHANGED
@@ -1,24 +1,47 @@
|
|
1 |
-
FROM docker.io/nvidia/cuda:12.2.2-runtime-ubuntu22.04
|
2 |
|
3 |
USER root
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
# Install system dependencies
|
6 |
-
RUN chmod 1777 /tmp
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
|
16 |
-
# Install Python
|
17 |
COPY requirements.txt .
|
18 |
-
RUN pip3 install --no-cache-dir -r requirements.txt
|
19 |
|
20 |
-
# Copy application
|
21 |
-
COPY main.py
|
22 |
|
23 |
-
|
24 |
-
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
1 |
+
FROM docker.io/nvidia/cuda:12.2.2-runtime-ubuntu22.04
|
2 |
|
3 |
USER root
|
4 |
|
5 |
+
# Set environment variables for cache directories
|
6 |
+
ENV MPLCONFIGDIR=/tmp/matplotlib \
|
7 |
+
TRANSFORMERS_CACHE=/tmp/huggingface \
|
8 |
+
HUGGINGFACE_HUB_CACHE=/tmp/huggingface \
|
9 |
+
DEBIAN_FRONTEND=noninteractive
|
10 |
+
|
11 |
# Install system dependencies
|
12 |
+
RUN chmod 1777 /tmp \
|
13 |
+
&& apt-get update -q \
|
14 |
+
&& apt-get install -y --no-install-recommends \
|
15 |
+
ca-certificates \
|
16 |
+
wget \
|
17 |
+
libgl1 \
|
18 |
+
python3 \
|
19 |
+
python3-pip \
|
20 |
+
libglib2.0-0 \
|
21 |
+
git \
|
22 |
+
# Install OpenSSL 1.1
|
23 |
+
&& wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.20_amd64.deb \
|
24 |
+
&& dpkg -i libssl1.1_1.1.1f-1ubuntu2.20_amd64.deb \
|
25 |
+
&& rm libssl1.1_1.1.1f-1ubuntu2.20_amd64.deb \
|
26 |
+
# Install CUDA repositories
|
27 |
+
&& wget -qO /tmp/cuda-keyring.deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb \
|
28 |
+
&& dpkg -i /tmp/cuda-keyring.deb \
|
29 |
+
&& apt-get update -q \
|
30 |
+
&& apt-get install -y --no-install-recommends \
|
31 |
+
libcudnn8 \
|
32 |
+
libcublas-12-2 \
|
33 |
+
# Clean up
|
34 |
+
&& apt-get clean \
|
35 |
+
&& rm -rf /var/lib/apt/lists/* \
|
36 |
+
# Create cache directories
|
37 |
+
&& mkdir -p ${MPLCONFIGDIR} ${TRANSFORMERS_CACHE} \
|
38 |
+
&& chmod -R 777 /tmp
|
39 |
|
40 |
+
# Install Python dependencies
|
41 |
COPY requirements.txt .
|
42 |
+
RUN pip3 install --no-cache-dir -r requirements.txt
|
43 |
|
44 |
+
# Copy application code
|
45 |
+
COPY main.py .
|
46 |
|
47 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|