nalin0503 commited on
Commit
b8b0697
·
1 Parent(s): 3f0cc27

try 12.5.1 devel ..... and building 3.12.9 from src

Browse files
Files changed (1) hide show
  1. Dockerfile +29 -20
Dockerfile CHANGED
@@ -1,25 +1,34 @@
1
- # Use NVIDIA’s CUDA 12.5.1 with cuDNN 9 on Ubuntu 22.04
2
- FROM nvidia/cuda:12.5.1-cudnn9-runtime-ubuntu22.04
3
 
4
- # Set non-interactive mode for apt-get
5
  ENV DEBIAN_FRONTEND=noninteractive
6
 
7
- # Install system packages and add deadsnakes PPA for Python 3.12.9
8
- RUN apt-get update && apt-get install -y --no-install-recommends \
9
- software-properties-common \
10
- && add-apt-repository ppa:deadsnakes/ppa -y \
11
- && apt-get update && apt-get install -y --no-install-recommends \
12
- python3.12 \
13
- python3.12-venv \
14
- python3.12-dev \
15
- python3-pip \
16
  git \
17
  curl \
18
- && rm -rf /var/lib/apt/lists/*
19
-
20
- # Create symlinks for python and pip
21
- RUN ln -s /usr/bin/python3.12 /usr/local/bin/python && \
22
- ln -s /usr/bin/pip3 /usr/local/bin/pip
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
 
24
  # Upgrade pip to the latest version
25
  RUN pip install --upgrade pip
@@ -30,10 +39,10 @@ RUN pip install torch torchvision --extra-index-url https://download.pytorch.org
30
  # Set the working directory
31
  WORKDIR /app
32
 
33
- # Copy requirements.txt first to leverage Docker caching
34
  COPY requirements.txt .
35
 
36
- # Install other Python dependencies
37
  RUN pip install -r requirements.txt
38
 
39
  # Copy the rest of your repository into the container
@@ -42,7 +51,7 @@ COPY . .
42
  # Set environment variable to mitigate CUDA memory fragmentation
43
  ENV PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
44
 
45
- # Expose the default port for Streamlit
46
  EXPOSE 8501
47
 
48
  # Command to run your Streamlit app
 
1
+ # Use NVIDIA’s CUDA 12.5.1 with cuDNN (devel) on UBI9
2
+ FROM nvidia/cuda:12.5.1-cudnn-devel-ubi9
3
 
4
+ # Set non-interactive mode
5
  ENV DEBIAN_FRONTEND=noninteractive
6
 
7
+ # Update and install necessary system packages with microdnf
8
+ RUN microdnf update -y && \
9
+ microdnf install -y \
 
 
 
 
 
 
10
  git \
11
  curl \
12
+ gcc \
13
+ gcc-c++ \
14
+ make \
15
+ openssl-devel \
16
+ bzip2-devel \
17
+ libffi-devel \
18
+ zlib-devel \
19
+ xz-devel && \
20
+ microdnf clean all
21
+
22
+ # Build and install Python 3.12.9 from source
23
+ RUN curl -L https://www.python.org/ftp/python/3.12.9/Python-3.12.9.tgz -o Python-3.12.9.tgz && \
24
+ tar -xf Python-3.12.9.tgz && \
25
+ cd Python-3.12.9 && \
26
+ ./configure --enable-optimizations && \
27
+ make -j $(nproc) && \
28
+ make altinstall && \
29
+ cd .. && rm -rf Python-3.12.9 Python-3.12.9.tgz && \
30
+ ln -s /usr/local/bin/python3.12 /usr/local/bin/python && \
31
+ ln -s /usr/local/bin/pip3.12 /usr/local/bin/pip
32
 
33
  # Upgrade pip to the latest version
34
  RUN pip install --upgrade pip
 
39
  # Set the working directory
40
  WORKDIR /app
41
 
42
+ # Copy requirements.txt first for caching
43
  COPY requirements.txt .
44
 
45
+ # Install Python dependencies
46
  RUN pip install -r requirements.txt
47
 
48
  # Copy the rest of your repository into the container
 
51
  # Set environment variable to mitigate CUDA memory fragmentation
52
  ENV PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
53
 
54
+ # Expose the default Streamlit port
55
  EXPOSE 8501
56
 
57
  # Command to run your Streamlit app