Fred808 commited on
Commit
97093c3
·
verified ·
1 Parent(s): da67cd6

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +16 -33
Dockerfile CHANGED
@@ -1,26 +1,9 @@
1
- # Base image with CUDA 11.8
2
- FROM nvidia/cuda:11.8.0-devel-ubuntu22.04
3
-
4
- # Set up Python 3.11
5
- RUN apt-get update && \
6
- apt-get install -y --no-install-recommends \
7
- python3.11 \
8
- python3.11-dev \
9
- python3-pip \
10
- python3.11-venv \
11
- && rm -rf /var/lib/apt/lists/*
12
-
13
- # Make Python 3.11 the default
14
- RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 1
15
 
16
  # Install system dependencies
17
  RUN apt-get update && \
18
  apt-get install -y --no-install-recommends \
19
- git \
20
- build-essential \
21
- cmake \
22
- libopenmpi-dev \
23
- openmpi-bin \
24
  unrar \
25
  libgl1 \
26
  libglib2.0-0 \
@@ -28,25 +11,25 @@ RUN apt-get update && \
28
 
29
  WORKDIR /app
30
 
31
- # Upgrade pip and install core dependencies first
32
- RUN python3 -m pip install --no-cache-dir --upgrade pip setuptools wheel packaging ninja
33
- RUN pip install --no-cache-dir "numpy<2"
34
 
35
- # Install PyTorch with CUDA 11.8 support
36
  RUN pip install --no-cache-dir \
37
- torch==2.1.2 \
38
- torchvision==0.16.2 \
39
- torchaudio==2.1.2 \
40
- --index-url https://download.pytorch.org/whl/cu118
41
-
42
- # Install flash-attn with compatible version
43
- RUN pip install --no-cache-dir flash-attn==2.3.3 --no-build-isolation
44
 
45
- # Copy and install remaining requirements
46
  COPY requirements.txt .
47
  RUN pip install --no-cache-dir -r requirements.txt
48
 
49
- # Copy app code
 
 
 
50
  COPY . .
51
 
52
  # Create non-root user
@@ -55,7 +38,7 @@ RUN useradd -m -u 1000 user && \
55
 
56
  USER user
57
 
58
- # Set environment variable to suppress HuggingFace warnings
59
  ENV HF_HUB_DISABLE_PROGRESS=1
60
  ENV TF_CPP_MIN_LOG_LEVEL=3
61
 
 
1
+ # Use official Python image
2
+ FROM python:3.11-slim-bullseye
 
 
 
 
 
 
 
 
 
 
 
 
3
 
4
  # Install system dependencies
5
  RUN apt-get update && \
6
  apt-get install -y --no-install-recommends \
 
 
 
 
 
7
  unrar \
8
  libgl1 \
9
  libglib2.0-0 \
 
11
 
12
  WORKDIR /app
13
 
14
+ # Install Python dependencies in optimal order
15
+ RUN pip install --no-cache-dir --upgrade pip setuptools wheel
 
16
 
17
+ # Install CPU-only PyTorch and compatible NumPy first
18
  RUN pip install --no-cache-dir \
19
+ "numpy<2" \
20
+ torch==2.1.2+cpu \
21
+ torchvision==0.16.2+cpu \
22
+ torchaudio==2.1.2+cpu \
23
+ --index-url https://download.pytorch.org/whl/cpu
 
 
24
 
25
+ # Install other requirements
26
  COPY requirements.txt .
27
  RUN pip install --no-cache-dir -r requirements.txt
28
 
29
+ # Remove flash-attn if not needed (GPU-only package)
30
+ RUN pip uninstall -y flash-attn || true
31
+
32
+ # Copy application code
33
  COPY . .
34
 
35
  # Create non-root user
 
38
 
39
  USER user
40
 
41
+ # Environment variables to suppress warnings
42
  ENV HF_HUB_DISABLE_PROGRESS=1
43
  ENV TF_CPP_MIN_LOG_LEVEL=3
44