MogensR commited on
Commit
09d0b5f
·
verified ·
1 Parent(s): 7d83c2e

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -12
Dockerfile CHANGED
@@ -1,7 +1,6 @@
1
  # ===============================
2
  # BackgroundFX Pro — Final Dockerfile
3
- # CUDA 12.1.1 + PyTorch 2.5.1 (cu121) + Streamlit
4
- # Optimized for SAM2 + MatAnyone + MediaPipe
5
  # ===============================
6
  ARG PYTHON_VERSION=3.10
7
  FROM nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04
@@ -36,7 +35,7 @@ RUN useradd -m -u 1000 user
36
  ENV HOME=/home/user
37
  WORKDIR $HOME/app
38
 
39
- # ---- System Dependencies (Including NumPy/Matplotlib Requirements) ----
40
  RUN apt-get update && apt-get install -y --no-install-recommends \
41
  git wget curl ca-certificates \
42
  python3 python3-pip python3-venv python3-dev \
@@ -55,13 +54,16 @@ RUN apt-get update && apt-get install -y --no-install-recommends ffmpeg \
55
  # ---- Python Bootstrap ----
56
  RUN python3 -m pip install --no-cache-dir --upgrade pip setuptools wheel
57
 
58
- # ---- Install NumPy First (Critical) ----
59
- RUN python3 -m pip install --no-cache-dir numpy==1.24.4
60
 
61
- # ---- Install Matplotlib with System Dependencies ----
62
  RUN python3 -m pip install --no-cache-dir matplotlib==3.5.0
63
 
64
- # ---- Install PyTorch (CUDA 12.1) ----
 
 
 
65
  RUN python3 -m pip install --no-cache-dir --index-url https://download.pytorch.org/whl/cu121 \
66
  torch==2.5.1 torchvision==0.20.1 torchaudio==2.5.1 \
67
  && python3 -c "import torch; print('PyTorch:', torch.__version__); print('CUDA available:', torch.cuda.is_available())"
@@ -70,9 +72,6 @@ RUN python3 -m pip install --no-cache-dir --index-url https://download.pytorch.o
70
  COPY requirements.txt .
71
  RUN python3 -m pip install --no-cache-dir -r requirements.txt
72
 
73
- # ---- Install MediaPipe (After NumPy/Matplotlib) ----
74
- RUN python3 -m pip install --no-cache-dir mediapipe==0.10.11
75
-
76
  # ---- Install MatAnyone ----
77
  RUN echo "Installing MatAnyone..." && \
78
  python3 -m pip install --no-cache-dir git+https://github.com/pq-yang/MatAnyone.git \
@@ -97,9 +96,9 @@ RUN mkdir -p /home/user/app/pipeline /home/user/app/models /home/user/app/storag
97
  # ---- Copy Application Code ----
98
  COPY --chown=user:user . .
99
 
100
- # ---- Healthcheck (Single Line) ----
101
  HEALTHCHECK --interval=30s --timeout=8s --retries=3 CMD \
102
- python3 -c "import numpy; print('NumPy:', numpy.__version__); import matplotlib; print('Matplotlib:', matplotlib.__version__); import torch; print('PyTorch:', torch.__version__); import mediapipe; print('MediaPipe:', mediapipe.__version__); import subprocess; subprocess.run(['ffmpeg', '-version'], check=False)"
103
 
104
  # ---- Runtime Startup ----
105
  USER user
 
1
  # ===============================
2
  # BackgroundFX Pro — Final Dockerfile
3
+ # CUDA 12.1.1 + PyTorch 2.5.1 + MediaPipe 0.10.11 + Matplotlib 3.5.0 + NumPy 1.21.6
 
4
  # ===============================
5
  ARG PYTHON_VERSION=3.10
6
  FROM nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04
 
35
  ENV HOME=/home/user
36
  WORKDIR $HOME/app
37
 
38
+ # ---- System Dependencies ----
39
  RUN apt-get update && apt-get install -y --no-install-recommends \
40
  git wget curl ca-certificates \
41
  python3 python3-pip python3-venv python3-dev \
 
54
  # ---- Python Bootstrap ----
55
  RUN python3 -m pip install --no-cache-dir --upgrade pip setuptools wheel
56
 
57
+ # ---- Install NumPy 1.21.6 (Required for MediaPipe) ----
58
+ RUN python3 -m pip install --no-cache-dir numpy==1.21.6
59
 
60
+ # ---- Install Matplotlib 3.5.0 (Compatible with NumPy 1.21.6) ----
61
  RUN python3 -m pip install --no-cache-dir matplotlib==3.5.0
62
 
63
+ # ---- Install MediaPipe 0.10.11 (After NumPy/Matplotlib) ----
64
+ RUN python3 -m pip install --no-cache-dir mediapipe==0.10.11
65
+
66
+ # ---- Install PyTorch 2.5.1 (CUDA 12.1) ----
67
  RUN python3 -m pip install --no-cache-dir --index-url https://download.pytorch.org/whl/cu121 \
68
  torch==2.5.1 torchvision==0.20.1 torchaudio==2.5.1 \
69
  && python3 -c "import torch; print('PyTorch:', torch.__version__); print('CUDA available:', torch.cuda.is_available())"
 
72
  COPY requirements.txt .
73
  RUN python3 -m pip install --no-cache-dir -r requirements.txt
74
 
 
 
 
75
  # ---- Install MatAnyone ----
76
  RUN echo "Installing MatAnyone..." && \
77
  python3 -m pip install --no-cache-dir git+https://github.com/pq-yang/MatAnyone.git \
 
96
  # ---- Copy Application Code ----
97
  COPY --chown=user:user . .
98
 
99
+ # ---- Healthcheck ----
100
  HEALTHCHECK --interval=30s --timeout=8s --retries=3 CMD \
101
+ python3 -c "import numpy; print('NumPy:', numpy.__version__); import matplotlib; print('Matplotlib:', matplotlib.__version__); import mediapipe; print('MediaPipe:', mediapipe.__version__); import torch; print('PyTorch:', torch.__version__)"
102
 
103
  # ---- Runtime Startup ----
104
  USER user