Example88 commited on
Commit
4d28228
·
1 Parent(s): 1c00921

Fix: Add OpenCV dependencies to Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +18 -7
Dockerfile CHANGED
@@ -1,22 +1,33 @@
1
- # CUDA 11.8 runtime مناسب لـ GPU T4
2
  FROM nvidia/cuda:11.8.0-runtime-ubuntu22.04
3
 
4
- # أدوات أساسية + Python
5
- RUN apt-get update && apt-get install -y python3-pip python3-dev git ffmpeg \
 
 
 
 
 
 
 
 
 
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 ["python", "app.py"]
 
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"]