Update Dockerfile
Browse files- Dockerfile +11 -22
Dockerfile
CHANGED
|
@@ -1,12 +1,13 @@
|
|
| 1 |
-
|
| 2 |
-
FROM nvidia/cuda:12.1.0-cudnn8-runtime-ubuntu22.04
|
| 3 |
|
| 4 |
# Set environment variables
|
| 5 |
ENV PYTHONUNBUFFERED=1 \
|
| 6 |
DEBIAN_FRONTEND=noninteractive \
|
| 7 |
CUDA_HOME=/usr/local/cuda \
|
| 8 |
PATH=/usr/local/cuda/bin:$PATH \
|
| 9 |
-
LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
|
|
|
|
|
|
|
| 10 |
|
| 11 |
# Install system dependencies
|
| 12 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
@@ -14,41 +15,29 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
| 14 |
python3-pip \
|
| 15 |
python3-dev \
|
| 16 |
build-essential \
|
| 17 |
-
curl \
|
| 18 |
ffmpeg \
|
| 19 |
libsndfile1 \
|
|
|
|
| 20 |
&& rm -rf /var/lib/apt/lists/*
|
| 21 |
|
| 22 |
# Upgrade pip and install build tools
|
| 23 |
-
RUN python3 -m pip install --
|
| 24 |
-
|
| 25 |
-
# Install PyTorch separately first
|
| 26 |
-
RUN pip3 install --no-cache-dir \
|
| 27 |
-
torch==2.4.1 \
|
| 28 |
-
torchaudio==2.4.1 \
|
| 29 |
-
torchvision==0.19.1 \
|
| 30 |
-
--extra-index-url https://download.pytorch.org/whl/cu121
|
| 31 |
|
| 32 |
-
# Set up working directory
|
| 33 |
WORKDIR /app
|
| 34 |
|
| 35 |
-
# Copy requirements first to leverage Docker cache
|
| 36 |
COPY requirements.txt .
|
| 37 |
|
| 38 |
-
#
|
| 39 |
-
RUN
|
| 40 |
|
| 41 |
-
# Install
|
| 42 |
RUN pip3 install --no-cache-dir -r requirements.txt
|
| 43 |
|
| 44 |
-
# Copy the rest of your application
|
| 45 |
COPY . .
|
| 46 |
|
| 47 |
-
#
|
| 48 |
-
RUN python3 -c "import torch;
|
| 49 |
|
| 50 |
-
# Expose port
|
| 51 |
EXPOSE 8000
|
| 52 |
|
| 53 |
-
# Start the application
|
| 54 |
CMD ["python3", "server.py"]
|
|
|
|
| 1 |
+
FROM nvidia/cuda:12.1.0-cudnn8-devel-ubuntu22.04
|
|
|
|
| 2 |
|
| 3 |
# Set environment variables
|
| 4 |
ENV PYTHONUNBUFFERED=1 \
|
| 5 |
DEBIAN_FRONTEND=noninteractive \
|
| 6 |
CUDA_HOME=/usr/local/cuda \
|
| 7 |
PATH=/usr/local/cuda/bin:$PATH \
|
| 8 |
+
LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH \
|
| 9 |
+
NVIDIA_VISIBLE_DEVICES=all \
|
| 10 |
+
NVIDIA_DRIVER_CAPABILITIES=compute,utility
|
| 11 |
|
| 12 |
# Install system dependencies
|
| 13 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
|
|
| 15 |
python3-pip \
|
| 16 |
python3-dev \
|
| 17 |
build-essential \
|
|
|
|
| 18 |
ffmpeg \
|
| 19 |
libsndfile1 \
|
| 20 |
+
curl \
|
| 21 |
&& rm -rf /var/lib/apt/lists/*
|
| 22 |
|
| 23 |
# Upgrade pip and install build tools
|
| 24 |
+
RUN python3 -m pip install --upgrade pip setuptools wheel
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
|
|
|
| 26 |
WORKDIR /app
|
| 27 |
|
|
|
|
| 28 |
COPY requirements.txt .
|
| 29 |
|
| 30 |
+
# Install PyTorch with CUDA support
|
| 31 |
+
RUN pip3 install --no-cache-dir torch==2.1.2 torchvision==0.16.2 torchaudio==2.1.2 --index-url https://download.pytorch.org/whl/cu121
|
| 32 |
|
| 33 |
+
# Install other requirements
|
| 34 |
RUN pip3 install --no-cache-dir -r requirements.txt
|
| 35 |
|
|
|
|
| 36 |
COPY . .
|
| 37 |
|
| 38 |
+
# Simple CUDA test
|
| 39 |
+
RUN python3 -c "import torch; print('CUDA available:', torch.cuda.is_available()); print('CUDA version:', torch.version.cuda); print('Device count:', torch.cuda.device_count())"
|
| 40 |
|
|
|
|
| 41 |
EXPOSE 8000
|
| 42 |
|
|
|
|
| 43 |
CMD ["python3", "server.py"]
|