tezuesh commited on
Commit
a2cecaa
·
verified ·
1 Parent(s): 7c42fd5

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -55
Dockerfile CHANGED
@@ -1,20 +1,14 @@
1
- FROM nvidia/cuda:12.1.0-cudnn8-devel-ubuntu22.04
2
 
3
- # System-level configuration
4
  ENV DEBIAN_FRONTEND=noninteractive \
5
  PYTHONUNBUFFERED=1 \
6
  CUDA_HOME=/usr/local/cuda \
7
  PATH=/usr/local/cuda/bin:$PATH \
8
- LD_LIBRARY_PATH=/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64:$LD_LIBRARY_PATH \
9
  TORCH_CUDA_ARCH_LIST="8.6" \
10
  NVIDIA_VISIBLE_DEVICES=all \
11
- NVIDIA_DRIVER_CAPABILITIES=compute,utility,video \
12
- TORCH_NVCC_FLAGS="-Xfatbin -compress-all" \
13
- MAX_JOBS=4 \
14
- CUDA_MODULE_LOADING=LAZY \
15
- PYTORCH_CUDA_ALLOC_CONF=max_split_size_mb:1024
16
 
17
- # System dependencies with CUDA development tools
18
  RUN apt-get update && apt-get install -y --no-install-recommends \
19
  build-essential \
20
  python3-dev \
@@ -23,61 +17,25 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
23
  ffmpeg \
24
  libsndfile1 \
25
  curl \
26
- nvidia-cuda-toolkit \
27
- nvidia-cuda-toolkit-gcc \
28
  && apt-get clean \
29
  && rm -rf /var/lib/apt/lists/*
30
 
31
- # Python environment setup
32
  RUN ln -sf /usr/bin/python3 /usr/bin/python && \
33
  curl -sS https://bootstrap.pypa.io/get-pip.py | python3 && \
34
  python3 -m pip install --no-cache-dir pip==23.3.1 setuptools==69.0.3 wheel==0.42.0
35
 
36
- # Install PyTorch with CUDA support explicitly
37
- RUN pip3 install --no-cache-dir \
38
- torch==2.1.2 \
39
- torchaudio==2.1.2 \
40
- torchvision==0.16.2 \
41
- --index-url https://download.pytorch.org/whl/cu121
42
-
43
- # Application directory setup with proper permissions
44
  WORKDIR /app
45
- RUN mkdir -p /app/cache /app/src && \
46
- chmod 777 /app/cache
47
-
48
- # Dependencies installation
49
- COPY requirements.txt /app/src/
50
- WORKDIR /app/src
51
- RUN pip3 install --no-cache-dir -r requirements.txt
52
 
53
- # Application code
54
- COPY . /app/src/
55
 
56
- # Runtime environment optimization for RTX A6000
57
- ENV MODEL_PATH=/app/cache \
58
- PYTHONPATH=/app/src:$PYTHONPATH \
59
- OMP_NUM_THREADS=8 \
60
- MKL_NUM_THREADS=8 \
61
- CUDA_LAUNCH_BLOCKING=0 \
62
- TORCH_CUDA_ARCH_LIST="8.6" \
63
- NVIDIA_VISIBLE_DEVICES=0 \
64
- PYTORCH_CUDA_ALLOC_CONF="max_split_size_mb:1024,garbage_collection_threshold:0.8" \
65
- NCCL_P2P_DISABLE=1
66
-
67
- # GPU verification and diagnostics specifically for RTX A6000
68
- RUN python3 -c '\
69
- import torch; \
70
- import os; \
71
- assert torch.cuda.is_available(), "CUDA unavailable"; \
72
- print(f"PyTorch version: {torch.__version__}"); \
73
- print(f"CUDA version: {torch.version.cuda}"); \
74
- print(f"CUDA device count: {torch.cuda.device_count()}"); \
75
- device = torch.cuda.current_device(); \
76
- print(f"Current device: {torch.cuda.get_device_name(device)}"); \
77
- print(f"Device memory: {torch.cuda.get_device_properties(device).total_memory / 1024**3:.2f} GB"); \
78
- print(f"CUDA_VISIBLE_DEVICES: {os.environ.get(\"CUDA_VISIBLE_DEVICES\")}"); \
79
- print(f"Architecture: {torch.cuda.get_device_capability(device)}");'
80
 
81
- EXPOSE 8000
 
82
 
83
- CMD ["python", "server.py"]
 
 
 
1
+ FROM nvidia/cuda:12.1.0-cudnn8-runtime-ubuntu22.04
2
 
 
3
  ENV DEBIAN_FRONTEND=noninteractive \
4
  PYTHONUNBUFFERED=1 \
5
  CUDA_HOME=/usr/local/cuda \
6
  PATH=/usr/local/cuda/bin:$PATH \
7
+ LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH \
8
  TORCH_CUDA_ARCH_LIST="8.6" \
9
  NVIDIA_VISIBLE_DEVICES=all \
10
+ NVIDIA_DRIVER_CAPABILITIES=all
 
 
 
 
11
 
 
12
  RUN apt-get update && apt-get install -y --no-install-recommends \
13
  build-essential \
14
  python3-dev \
 
17
  ffmpeg \
18
  libsndfile1 \
19
  curl \
 
 
20
  && apt-get clean \
21
  && rm -rf /var/lib/apt/lists/*
22
 
23
+ # Python environment configuration
24
  RUN ln -sf /usr/bin/python3 /usr/bin/python && \
25
  curl -sS https://bootstrap.pypa.io/get-pip.py | python3 && \
26
  python3 -m pip install --no-cache-dir pip==23.3.1 setuptools==69.0.3 wheel==0.42.0
27
 
 
 
 
 
 
 
 
 
28
  WORKDIR /app
 
 
 
 
 
 
 
29
 
30
+ # Copy requirements first to leverage Docker cache
31
+ COPY requirements.txt .
32
 
33
+ # Install PyTorch first (separately to avoid conflicts)
34
+ RUN pip3 install --no-cache-dir torch==2.1.2 torchvision==0.16.2 --index-url https://download.pytorch.org/whl/cu121
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
 
36
+ # Then install other requirements
37
+ RUN pip3 install --no-cache-dir -r requirements.txt
38
 
39
+ # Create directories after all installations
40
+ RUN mkdir -p /app/cache /app/src && \
41
+ chmod 777 /app/cache