Spaces:
Build error
Build error
Fix: Add OpenCV dependencies to Dockerfile
Browse files- Dockerfile +18 -7
Dockerfile
CHANGED
@@ -1,22 +1,33 @@
|
|
1 |
-
# CUDA 11.8
|
2 |
FROM nvidia/cuda:11.8.0-runtime-ubuntu22.04
|
3 |
|
4 |
-
#
|
5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
&& rm -rf /var/lib/apt/lists/*
|
7 |
|
8 |
-
#
|
9 |
RUN useradd -m -u 1000 user
|
10 |
USER user
|
11 |
WORKDIR /app
|
12 |
ENV PATH="/home/user/.local/bin:$PATH"
|
13 |
|
14 |
-
#
|
15 |
COPY --chown=user requirements.txt .
|
|
|
16 |
RUN pip install --no-cache-dir -r requirements.txt
|
17 |
|
18 |
-
#
|
19 |
COPY --chown=user . /app
|
20 |
|
|
|
21 |
EXPOSE 7860
|
22 |
-
CMD ["
|
|
|
1 |
+
# Use a base image with CUDA 11.8 and Ubuntu 22.04
|
2 |
FROM nvidia/cuda:11.8.0-runtime-ubuntu22.04
|
3 |
|
4 |
+
# Avoid prompts from apt
|
5 |
+
ENV DEBIAN_FRONTEND=noninteractive
|
6 |
+
|
7 |
+
# Install system dependencies for Python, Git, FFmpeg, and OpenCV
|
8 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
9 |
+
python3-pip \
|
10 |
+
python3-dev \
|
11 |
+
git \
|
12 |
+
ffmpeg \
|
13 |
+
libgl1-mesa-glx \
|
14 |
+
libglib2.0-0 \
|
15 |
&& rm -rf /var/lib/apt/lists/*
|
16 |
|
17 |
+
# Create a non-root user
|
18 |
RUN useradd -m -u 1000 user
|
19 |
USER user
|
20 |
WORKDIR /app
|
21 |
ENV PATH="/home/user/.local/bin:$PATH"
|
22 |
|
23 |
+
# Copy and install Python requirements
|
24 |
COPY --chown=user requirements.txt .
|
25 |
+
RUN python3 -m pip install --upgrade pip
|
26 |
RUN pip install --no-cache-dir -r requirements.txt
|
27 |
|
28 |
+
# Copy the application code
|
29 |
COPY --chown=user . /app
|
30 |
|
31 |
+
# Expose the port and run the app
|
32 |
EXPOSE 7860
|
33 |
+
CMD ["python3", "app.py"]
|