tezuesh commited on
Commit
6b03d8c
·
verified ·
1 Parent(s): c76fdc5

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +47 -61
Dockerfile CHANGED
@@ -1,72 +1,58 @@
1
- # FROM pytorch/pytorch:2.1.2-cuda12.1-cudnn8-runtime
2
 
3
- # WORKDIR /app
 
 
 
 
 
 
 
4
 
5
- # # Install system dependencies
6
- # RUN echo "Installing system dependencies..." && \
7
- # apt-get update && \
8
- # DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
9
- # build-essential \
10
- # python3-dev \
11
- # git \
12
- # ffmpeg \
13
- # libsndfile1 \
14
- # curl \
15
- # && rm -rf /var/lib/apt/lists/* && \
16
- # echo "System dependencies installed successfully"
17
-
18
- # # Pre-install critical dependencies
19
- # RUN pip install --no-cache-dir --upgrade pip setuptools wheel
20
-
21
- # # Create cache directory with correct permissions
22
- # RUN mkdir -p /app/cache && chmod 777 /app/cache
23
-
24
- # # Copy the entire repository contents
25
- # COPY . /app/src/
26
-
27
- # # Install Python requirements
28
- # WORKDIR /app/src
29
- # RUN pip install --no-cache-dir -r requirements.txt
30
-
31
- # # Environment variables
32
- # ENV PYTHONUNBUFFERED=1
33
- # ENV MODEL_PATH=/app/cache
34
- # ENV PYTHONPATH=/app/src:$PYTHONPATH
35
-
36
- # EXPOSE 8000
37
-
38
- # CMD ["python", "server.py"]
39
-
40
-
41
-
42
-
43
-
44
- ###########################
45
- #FROM nvidia/cuda:11.8.0-runtime-ubuntu22.04
46
-
47
- ENV DEBIAN_FRONTEND=noninteractive
48
- ENV PYTHONUNBUFFERED=1
49
- ENV CUDA_HOME=/usr/local/cuda
50
- ENV PATH=${CUDA_HOME}/bin:${PATH}
51
- ENV LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH}
52
 
53
- # Install system dependencies
54
- RUN apt-get update && apt-get install -y \
55
- python3-pip \
56
  python3-dev \
57
  git \
 
 
58
  curl \
59
  && rm -rf /var/lib/apt/lists/*
60
 
61
- # Install Python dependencies
62
- COPY requirements.txt .
63
- RUN pip3 install --no-cache-dir -r requirements.txt
64
 
65
- # Set up model directory
66
- WORKDIR /app
67
- COPY . /app/src/
 
68
 
69
- # Verify GPU access
70
- RUN python3 -c "import torch; print('CUDA available:', torch.cuda.is_available())"
 
 
 
 
 
71
 
72
- CMD ["python3", "/app/src/server.py"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM pytorch/pytorch:2.1.2-cuda12.1-cudnn8-runtime
2
 
3
+ # NVIDIA Container Runtime Configuration
4
+ ENV NVIDIA_VISIBLE_DEVICES=all \
5
+ NVIDIA_DRIVER_CAPABILITIES=compute,utility \
6
+ CUDA_HOME=/usr/local/cuda \
7
+ PATH=${CUDA_HOME}/bin:${PATH} \
8
+ LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH} \
9
+ TORCH_CUDA_ARCH_LIST="8.6" \
10
+ FORCE_CUDA="1"
11
 
12
+ WORKDIR /app
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
 
14
+ # System Dependencies with Explicit Versions
15
+ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
16
+ build-essential \
17
  python3-dev \
18
  git \
19
+ ffmpeg \
20
+ libsndfile1 \
21
  curl \
22
  && rm -rf /var/lib/apt/lists/*
23
 
24
+ # Python Environment Setup
25
+ RUN python3 -m pip install --no-cache-dir --upgrade pip setuptools wheel
 
26
 
27
+ # Cache Directory Configuration
28
+ RUN mkdir -p /app/cache && \
29
+ chmod 777 /app/cache && \
30
+ mkdir -p /app/src
31
 
32
+ # Application Setup - Two-Stage Copy for Better Caching
33
+ COPY requirements.txt /app/src/
34
+ WORKDIR /app/src
35
+ RUN pip install --no-cache-dir -r requirements.txt
36
+
37
+ # Copy Application Code
38
+ COPY . /app/src/
39
 
40
+ # Environment Configuration
41
+ ENV PYTHONUNBUFFERED=1 \
42
+ MODEL_PATH=/app/cache \
43
+ PYTHONPATH=/app/src:$PYTHONPATH \
44
+ OMP_NUM_THREADS=1 \
45
+ MKL_NUM_THREADS=1
46
+
47
+ # GPU Verification with Detailed Output
48
+ RUN python3 -c "import torch; \
49
+ assert torch.cuda.is_available(), 'CUDA not available'; \
50
+ device = torch.cuda.current_device(); \
51
+ print(f'CUDA Device Index: {device}'); \
52
+ print(f'CUDA Device Name: {torch.cuda.get_device_name(device)}'); \
53
+ print(f'CUDA Device Arch: {torch.cuda.get_device_capability(device)}'); \
54
+ print(f'CUDA Version: {torch.version.cuda}')"
55
+
56
+ EXPOSE 8000
57
+
58
+ CMD ["python3", "server.py"]