MogensR commited on
Commit
ec5f699
·
verified ·
1 Parent(s): fed9904

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +4 -23
Dockerfile CHANGED
@@ -1,10 +1,9 @@
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
7
-
8
  # ---- Environment Setup ----
9
  ENV DEBIAN_FRONTEND=noninteractive \
10
  PYTHONUNBUFFERED=1 \
@@ -29,12 +28,10 @@ ENV DEBIAN_FRONTEND=noninteractive \
29
  MATANY_DEVICE=cuda \
30
  TF_CPP_MIN_LOG_LEVEL=2 \
31
  SAM2_CHECKPOINT=/home/user/app/checkpoints/sam2.1_hiera_large.pt
32
-
33
  # ---- Non-root User ----
34
  RUN useradd -m -u 1000 user
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 \
@@ -46,60 +43,44 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
46
  libblas-dev liblapack-dev gfortran \
47
  libfreetype6-dev libpng-dev libjpeg-dev \
48
  && rm -rf /var/lib/apt/lists/*
49
-
50
  # ---- Install FFmpeg ----
51
  RUN apt-get update && apt-get install -y --no-install-recommends ffmpeg \
52
  && rm -rf /var/lib/apt/lists/*
53
-
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())"
70
-
71
  # ---- Copy Requirements ----
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 \
78
  && python3 -c "import matanyone; print('✅ MatAnyone installed')"
79
-
80
  # ---- Install SAM2 (Editable) ----
81
  RUN echo "Installing SAM2..." && \
82
  git clone --depth=1 https://github.com/facebookresearch/segment-anything-2.git third_party/sam2 && \
83
  cd third_party/sam2 && \
84
  python3 -m pip install --no-cache-dir -e .
85
-
86
  # ---- Download SAM2 Checkpoints ----
87
  RUN mkdir -p /home/user/app/checkpoints && \
88
  wget -q --show-progress -O /home/user/app/checkpoints/sam2.1_hiera_large.pt \
89
  https://dl.fbaipublicfiles.com/segment_anything_2/092824/sam2.1_hiera_large.pt
90
-
91
  # ---- Create Directory Structure ----
92
  RUN mkdir -p /home/user/app/pipeline /home/user/app/models /home/user/app/storage && \
93
  chown -R user:user /home/user/app && \
94
  chmod -R 755 /home/user/app
95
-
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
105
  EXPOSE 7860
@@ -119,4 +100,4 @@ CMD ["sh", "-c", "\
119
  exec streamlit run --server.port=${PORT} --server.address=0.0.0.0 \
120
  --server.maxUploadSize=200 --server.enableCORS=false \
121
  --server.enableXsrfProtection=false --logger.level=debug \
122
- streamlit_app.py"]
 
1
  # ===============================
2
  # BackgroundFX Pro — Final Dockerfile
3
+ # CUDA 12.1.1 + PyTorch 2.5.1 + 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
 
7
  # ---- Environment Setup ----
8
  ENV DEBIAN_FRONTEND=noninteractive \
9
  PYTHONUNBUFFERED=1 \
 
28
  MATANY_DEVICE=cuda \
29
  TF_CPP_MIN_LOG_LEVEL=2 \
30
  SAM2_CHECKPOINT=/home/user/app/checkpoints/sam2.1_hiera_large.pt
 
31
  # ---- Non-root User ----
32
  RUN useradd -m -u 1000 user
33
  ENV HOME=/home/user
34
  WORKDIR $HOME/app
 
35
  # ---- System Dependencies ----
36
  RUN apt-get update && apt-get install -y --no-install-recommends \
37
  git wget curl ca-certificates \
 
43
  libblas-dev liblapack-dev gfortran \
44
  libfreetype6-dev libpng-dev libjpeg-dev \
45
  && rm -rf /var/lib/apt/lists/*
 
46
  # ---- Install FFmpeg ----
47
  RUN apt-get update && apt-get install -y --no-install-recommends ffmpeg \
48
  && rm -rf /var/lib/apt/lists/*
 
49
  # ---- Python Bootstrap ----
50
  RUN python3 -m pip install --no-cache-dir --upgrade pip setuptools wheel
51
+ # ---- Install NumPy 1.21.6 ----
 
52
  RUN python3 -m pip install --no-cache-dir numpy==1.21.6
 
53
  # ---- Install Matplotlib 3.5.0 (Compatible with NumPy 1.21.6) ----
54
  RUN python3 -m pip install --no-cache-dir matplotlib==3.5.0
 
 
 
 
55
  # ---- Install PyTorch 2.5.1 (CUDA 12.1) ----
56
  RUN python3 -m pip install --no-cache-dir --index-url https://download.pytorch.org/whl/cu121 \
57
  torch==2.5.1 torchvision==0.20.1 torchaudio==2.5.1 \
58
  && python3 -c "import torch; print('PyTorch:', torch.__version__); print('CUDA available:', torch.cuda.is_available())"
 
59
  # ---- Copy Requirements ----
60
  COPY requirements.txt .
61
  RUN python3 -m pip install --no-cache-dir -r requirements.txt
 
62
  # ---- Install MatAnyone ----
63
  RUN echo "Installing MatAnyone..." && \
64
  python3 -m pip install --no-cache-dir git+https://github.com/pq-yang/MatAnyone.git \
65
  && python3 -c "import matanyone; print('✅ MatAnyone installed')"
 
66
  # ---- Install SAM2 (Editable) ----
67
  RUN echo "Installing SAM2..." && \
68
  git clone --depth=1 https://github.com/facebookresearch/segment-anything-2.git third_party/sam2 && \
69
  cd third_party/sam2 && \
70
  python3 -m pip install --no-cache-dir -e .
 
71
  # ---- Download SAM2 Checkpoints ----
72
  RUN mkdir -p /home/user/app/checkpoints && \
73
  wget -q --show-progress -O /home/user/app/checkpoints/sam2.1_hiera_large.pt \
74
  https://dl.fbaipublicfiles.com/segment_anything_2/092824/sam2.1_hiera_large.pt
 
75
  # ---- Create Directory Structure ----
76
  RUN mkdir -p /home/user/app/pipeline /home/user/app/models /home/user/app/storage && \
77
  chown -R user:user /home/user/app && \
78
  chmod -R 755 /home/user/app
 
79
  # ---- Copy Application Code ----
80
  COPY --chown=user:user . .
 
81
  # ---- Healthcheck ----
82
  HEALTHCHECK --interval=30s --timeout=8s --retries=3 CMD \
83
+ python3 -c "import numpy; print('NumPy:', numpy.__version__); import matplotlib; print('Matplotlib:', matplotlib.__version__); import torch; print('PyTorch:', torch.__version__)"
 
84
  # ---- Runtime Startup ----
85
  USER user
86
  EXPOSE 7860
 
100
  exec streamlit run --server.port=${PORT} --server.address=0.0.0.0 \
101
  --server.maxUploadSize=200 --server.enableCORS=false \
102
  --server.enableXsrfProtection=false --logger.level=debug \
103
+ streamlit_app.py"]