Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +26 -15
Dockerfile
CHANGED
@@ -1,35 +1,46 @@
|
|
1 |
-
#
|
2 |
-
FROM
|
3 |
-
|
4 |
-
#
|
5 |
-
RUN apt-get update
|
6 |
-
|
|
|
|
|
|
|
7 |
libglib2.0-0 \
|
8 |
wget \
|
9 |
git \
|
10 |
&& rm -rf /var/lib/apt/lists/*
|
11 |
|
12 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
WORKDIR /app
|
14 |
|
15 |
-
#
|
16 |
COPY requirements.txt .
|
17 |
RUN pip install --no-cache-dir -r requirements.txt
|
18 |
|
19 |
-
# Create directories
|
20 |
-
RUN mkdir -p /app/weights
|
21 |
-
|
22 |
|
23 |
-
#
|
24 |
COPY main.py utils.py download_models.py ./
|
25 |
|
26 |
-
# Download models
|
27 |
RUN python download_models.py
|
28 |
|
29 |
-
# Set up user
|
30 |
RUN useradd -m -u 1000 user
|
31 |
USER user
|
32 |
ENV PATH="/home/user/.local/bin:$PATH"
|
33 |
|
34 |
-
# Run the application
|
35 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
1 |
+
# Base image with CUDA 12.2
|
2 |
+
FROM nvidia/cuda:12.2.0-runtime-ubuntu22.04
|
3 |
+
|
4 |
+
# System dependencies
|
5 |
+
RUN apt-get update -q && \
|
6 |
+
apt-get install -y --no-install-recommends \
|
7 |
+
python3.9 \
|
8 |
+
python3-pip \
|
9 |
+
libgl1 \
|
10 |
libglib2.0-0 \
|
11 |
wget \
|
12 |
git \
|
13 |
&& rm -rf /var/lib/apt/lists/*
|
14 |
|
15 |
+
# CUDA/CuDNN setup
|
16 |
+
RUN wget -qO /tmp/cuda-keyring.deb \
|
17 |
+
https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb && \
|
18 |
+
dpkg -i /tmp/cuda-keyring.deb && \
|
19 |
+
apt-get update -q && \
|
20 |
+
apt-get install -y --no-install-recommends \
|
21 |
+
libcudnn8 \
|
22 |
+
libcublas-12-2 && \
|
23 |
+
rm -rf /var/lib/apt/lists/*
|
24 |
+
|
25 |
WORKDIR /app
|
26 |
|
27 |
+
# Python dependencies
|
28 |
COPY requirements.txt .
|
29 |
RUN pip install --no-cache-dir -r requirements.txt
|
30 |
|
31 |
+
# Create directories
|
32 |
+
RUN mkdir -p /app/{weights,imgs} && \
|
33 |
+
chmod -R 777 /app
|
34 |
|
35 |
+
# Application code
|
36 |
COPY main.py utils.py download_models.py ./
|
37 |
|
38 |
+
# Download models
|
39 |
RUN python download_models.py
|
40 |
|
41 |
+
# Set up user
|
42 |
RUN useradd -m -u 1000 user
|
43 |
USER user
|
44 |
ENV PATH="/home/user/.local/bin:$PATH"
|
45 |
|
|
|
46 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|