Update Dockerfile
Browse files- Dockerfile +38 -37
Dockerfile
CHANGED
|
@@ -1,57 +1,58 @@
|
|
| 1 |
FROM pytorch/pytorch:2.1.2-cuda12.1-cudnn8-runtime
|
| 2 |
|
| 3 |
-
#
|
| 4 |
-
ENV
|
| 5 |
-
|
| 6 |
CUDA_HOME=/usr/local/cuda \
|
| 7 |
-
PATH=
|
| 8 |
-
LD_LIBRARY_PATH=
|
| 9 |
TORCH_CUDA_ARCH_LIST="8.6" \
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
python3-
|
| 18 |
-
git \
|
| 19 |
-
ffmpeg \
|
| 20 |
-
libsndfile1 \
|
| 21 |
-
curl \
|
|
|
|
| 22 |
&& rm -rf /var/lib/apt/lists/*
|
| 23 |
|
| 24 |
-
# Python
|
| 25 |
-
RUN
|
|
|
|
|
|
|
| 26 |
|
| 27 |
-
#
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
|
| 32 |
-
#
|
| 33 |
COPY requirements.txt /app/src/
|
| 34 |
WORKDIR /app/src
|
| 35 |
-
RUN pip install --no-cache-dir -r requirements.txt
|
| 36 |
|
| 37 |
-
#
|
| 38 |
COPY . /app/src/
|
| 39 |
|
| 40 |
-
#
|
| 41 |
-
ENV
|
| 42 |
-
MODEL_PATH=/app/cache \
|
| 43 |
PYTHONPATH=/app/src:$PYTHONPATH \
|
| 44 |
OMP_NUM_THREADS=1 \
|
| 45 |
MKL_NUM_THREADS=1
|
| 46 |
|
| 47 |
-
# GPU
|
| 48 |
-
RUN python3 -c
|
| 49 |
-
assert torch.cuda.is_available(),
|
| 50 |
-
|
| 51 |
-
print(f
|
| 52 |
-
print(f
|
| 53 |
-
print(f
|
| 54 |
-
print(f'CUDA Version: {torch.version.cuda}')"
|
| 55 |
|
| 56 |
EXPOSE 8000
|
| 57 |
|
|
|
|
| 1 |
FROM pytorch/pytorch:2.1.2-cuda12.1-cudnn8-runtime
|
| 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:$LD_LIBRARY_PATH \
|
| 9 |
TORCH_CUDA_ARCH_LIST="8.6" \
|
| 10 |
+
NVIDIA_VISIBLE_DEVICES=all \
|
| 11 |
+
NVIDIA_DRIVER_CAPABILITIES=compute,utility
|
| 12 |
+
|
| 13 |
+
# System dependencies with explicit version control
|
| 14 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 15 |
+
build-essential=12.9ubuntu3 \
|
| 16 |
+
python3-dev=3.10.6-1~22.04 \
|
| 17 |
+
python3-pip=22.0.2+dfsg-1ubuntu0.4 \
|
| 18 |
+
git=1:2.34.1-1ubuntu1.10 \
|
| 19 |
+
ffmpeg=7:4.4.2-0ubuntu0.22.04.1 \
|
| 20 |
+
libsndfile1=1.0.31-2ubuntu0.1 \
|
| 21 |
+
curl=7.81.0-1ubuntu1.15 \
|
| 22 |
+
&& apt-get clean \
|
| 23 |
&& rm -rf /var/lib/apt/lists/*
|
| 24 |
|
| 25 |
+
# Python environment configuration
|
| 26 |
+
RUN ln -sf /usr/bin/python3 /usr/bin/python && \
|
| 27 |
+
curl -sS https://bootstrap.pypa.io/get-pip.py | python3 && \
|
| 28 |
+
python3 -m pip install --no-cache-dir pip==23.3.1 setuptools==69.0.3 wheel==0.42.0
|
| 29 |
|
| 30 |
+
# Application directory structure
|
| 31 |
+
WORKDIR /app
|
| 32 |
+
RUN mkdir -p /app/cache /app/src && \
|
| 33 |
+
chmod 777 /app/cache
|
| 34 |
|
| 35 |
+
# Dependencies installation (two-stage for better caching)
|
| 36 |
COPY requirements.txt /app/src/
|
| 37 |
WORKDIR /app/src
|
| 38 |
+
RUN python3 -m pip install --no-cache-dir -r requirements.txt
|
| 39 |
|
| 40 |
+
# Application code
|
| 41 |
COPY . /app/src/
|
| 42 |
|
| 43 |
+
# Runtime environment
|
| 44 |
+
ENV MODEL_PATH=/app/cache \
|
|
|
|
| 45 |
PYTHONPATH=/app/src:$PYTHONPATH \
|
| 46 |
OMP_NUM_THREADS=1 \
|
| 47 |
MKL_NUM_THREADS=1
|
| 48 |
|
| 49 |
+
# GPU verification with comprehensive diagnostics
|
| 50 |
+
RUN python3 -c 'import torch; \
|
| 51 |
+
assert torch.cuda.is_available(), "CUDA unavailable"; \
|
| 52 |
+
print(f"PyTorch: {torch.__version__}"); \
|
| 53 |
+
print(f"CUDA: {torch.version.cuda}"); \
|
| 54 |
+
print(f"GPU: {torch.cuda.get_device_name()}"); \
|
| 55 |
+
print(f"Arch: {torch.cuda.get_device_capability()}");'
|
|
|
|
| 56 |
|
| 57 |
EXPOSE 8000
|
| 58 |
|