ayushpfullstack commited on
Commit
d7a035d
·
verified ·
1 Parent(s): 9caca79

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -11
Dockerfile CHANGED
@@ -1,33 +1,33 @@
1
- # Change this line to use the modern "Bookworm" base image
2
- FROM python:3.10-slim-bookworm
3
 
4
  # Set up the environment
5
  ENV DEBIAN_FRONTEND=noninteractive
6
  ENV PYTHONUNBUFFERED=1
7
 
8
- # Install system dependencies needed for OpenCV
9
- RUN apt-get update && apt-get install -y libgl1-mesa-glx && rm -rf /var/lib/apt/lists/*
 
 
10
 
11
  # Set the working directory
12
  WORKDIR /app
13
 
14
  # Set a writable cache directory
15
  ENV HF_HOME=/app/cache
16
-
17
- # Create the cache directory
18
  RUN mkdir -p /app/cache && chmod 777 /app/cache
19
 
20
- # Install PyTorch for CUDA 11.3. It will link to the host's CUDA libraries at runtime.
21
- RUN pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 torchaudio==0.12.1 --extra-index-url https://download.pytorch.org/whl/cu113
22
 
23
- # Copy and install the rest of the Python dependencies
24
  COPY requirements.txt .
25
- RUN pip install --no-cache-dir -r requirements.txt
26
 
27
  # Copy your main application code
28
  COPY main.py .
29
 
30
- # Expose the port your API will run on
31
  EXPOSE 8000
32
 
33
  # The command to start the Uvicorn server
 
1
+ # Use the CUDA 11.8 base image that we know works
2
+ FROM nvidia/cuda:11.8.0-devel-ubuntu22.04
3
 
4
  # Set up the environment
5
  ENV DEBIAN_FRONTEND=noninteractive
6
  ENV PYTHONUNBUFFERED=1
7
 
8
+ # Install Python 3.10
9
+ RUN apt-get update && apt-get install -y \
10
+ python3.10 python3-pip libgl1-mesa-glx \
11
+ && rm -rf /var/lib/apt/lists/*
12
 
13
  # Set the working directory
14
  WORKDIR /app
15
 
16
  # Set a writable cache directory
17
  ENV HF_HOME=/app/cache
 
 
18
  RUN mkdir -p /app/cache && chmod 777 /app/cache
19
 
20
+ # Install the exact, known-good version of PyTorch for CUDA 11.8
21
+ RUN pip3 install torch==2.1.2+cu118 torchvision==0.16.2+cu118 --extra-index-url https://download.pytorch.org/whl/cu118
22
 
23
+ # Copy and install the rest of the dependencies
24
  COPY requirements.txt .
25
+ RUN pip3 install --no-cache-dir -r requirements.txt
26
 
27
  # Copy your main application code
28
  COPY main.py .
29
 
30
+ # Expose the port
31
  EXPOSE 8000
32
 
33
  # The command to start the Uvicorn server