Leon4gr45 commited on
Commit
81dc730
·
verified ·
1 Parent(s): ab1c9a3

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +17 -15
Dockerfile CHANGED
@@ -1,30 +1,32 @@
1
- # Use a standard base image with CUDA support
2
- FROM pytorch/pytorch:2.3.0-cuda12.1-cudnn8-runtime
3
 
4
- # Set environment variables for caching AND for CUDA libraries
5
  ENV DEBIAN_FRONTEND=noninteractive
6
- ENV HF_HOME="/data/huggingface"
7
- ENV UV_CACHE_DIR="/data/uv_cache"
8
 
9
- # --- THE CRITICAL FIX ---
10
- # Tell the dynamic linker where to find the NVIDIA CUDA libraries.
11
- # This makes `libcuda.so.1` visible to vLLM.
12
- ENV LD_LIBRARY_PATH=/usr/local/nvidia/lib64:$LD_LIBRARY_PATH
 
 
 
13
 
14
- # Install git and uv (for faster package installation)
15
- RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*
16
  RUN pip install uv
17
 
18
- # Copy requirements and install them efficiently into the system environment
 
19
  COPY requirements.txt .
20
  RUN uv pip install --no-cache --system -r requirements.txt
21
 
22
- # Copy the application code into the container
23
  COPY ./app.py /app/app.py
24
  WORKDIR /app
25
 
26
- # Expose the port the app will run on
27
  EXPOSE 7860
28
 
29
- # The command to run the FastAPI app
30
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ # 1. Start from the official NVIDIA CUDA development image. This is the key change.
2
+ FROM nvidia/cuda:12.1.1-devel-ubuntu22.04
3
 
4
+ # 2. Set up the environment to be non-interactive and add Python paths
5
  ENV DEBIAN_FRONTEND=noninteractive
6
+ ENV PATH="/root/.local/bin:${PATH}"
 
7
 
8
+ # 3. Install Python 3.11, pip, and other essential tools
9
+ RUN apt-get update && apt-get install -y --no-install-recommends \
10
+ python3.11 \
11
+ python3-pip \
12
+ python-is-python3 \
13
+ git \
14
+ && rm -rf /var/lib/apt/lists/*
15
 
16
+ # 4. Install uv for fast package installation
 
17
  RUN pip install uv
18
 
19
+ # 5. Copy requirements and install them.
20
+ # The base image is clean, so we need to install everything, including torch.
21
  COPY requirements.txt .
22
  RUN uv pip install --no-cache --system -r requirements.txt
23
 
24
+ # 6. Copy the application code
25
  COPY ./app.py /app/app.py
26
  WORKDIR /app
27
 
28
+ # 7. Expose the port
29
  EXPOSE 7860
30
 
31
+ # 8. Run the application with uvicorn
32
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]