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

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -18
Dockerfile CHANGED
@@ -1,32 +1,27 @@
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"]
 
1
+ # 1. Start from the PyTorch DEVEL image. This is the correct, full-featured base.
2
+ FROM pytorch/pytorch:2.3.0-cuda12.1-cudnn8-devel
3
 
4
+ # 2. Set environment variables. The LD_LIBRARY_PATH is good practice but may be redundant
5
+ # in this well-configured image. It doesn't hurt to keep it.
6
  ENV DEBIAN_FRONTEND=noninteractive
7
+ ENV HF_HOME="/data/huggingface"
8
+ ENV UV_CACHE_DIR="/data/uv_cache"
9
+ ENV LD_LIBRARY_PATH=/usr/local/nvidia/lib64:$LD_LIBRARY_PATH
10
 
11
+ # 3. Install git and uv. The base image has most tools, but we add these.
12
+ RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*
 
 
 
 
 
 
 
13
  RUN pip install uv
14
 
15
+ # 4. Copy requirements and install them.
 
16
  COPY requirements.txt .
17
  RUN uv pip install --no-cache --system -r requirements.txt
18
 
19
+ # 5. Copy the application code.
20
  COPY ./app.py /app/app.py
21
  WORKDIR /app
22
 
23
+ # 6. Expose the port.
24
  EXPOSE 7860
25
 
26
+ # 7. Run the application with uvicorn.
27
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]