david167 commited on
Commit
bf883f3
·
1 Parent(s): 0bf99b7

Add fixed Dockerfile using python:3.10 base image

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -25
Dockerfile CHANGED
@@ -1,61 +1,47 @@
1
- # Use NVIDIA CUDA base image optimized for A10G
2
- FROM nvidia/cuda:11.8-devel-ubuntu20.04
3
 
4
  # Set environment variables
5
- ENV DEBIAN_FRONTEND=noninteractive
6
  ENV PYTHONUNBUFFERED=1
7
- ENV CUDA_VISIBLE_DEVICES=0
8
 
9
  # Install system dependencies
10
  RUN apt-get update && apt-get install -y \
11
- python3.9 \
12
- python3.9-dev \
13
- python3-pip \
14
  git \
15
- wget \
16
  curl \
17
  build-essential \
18
  cmake \
19
  && rm -rf /var/lib/apt/lists/*
20
 
21
- # Set Python 3.9 as default
22
- RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.9 1
23
- RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1
24
-
25
  # Upgrade pip
26
- RUN python -m pip install --upgrade pip
27
 
28
  # Set working directory
29
  WORKDIR /app
30
 
31
- # Copy requirements first for better caching
32
  COPY requirements.txt .
33
 
34
- # Install Python dependencies with CUDA support
35
- RUN pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
36
 
37
  # Install llama-cpp-python with CUDA support
38
  ENV CMAKE_ARGS="-DLLAMA_CUBLAS=on"
39
- ENV FORCE_CMAKE=1
40
  RUN pip install llama-cpp-python --force-reinstall --no-cache-dir
41
 
42
  # Install other requirements
43
  RUN pip install -r requirements.txt
44
 
45
- # Copy application code
46
  COPY app.py .
47
  COPY README.md .
48
 
49
- # Create cache directory for Hugging Face
50
- RUN mkdir -p /app/.cache
51
- ENV HF_HOME=/app/.cache
52
 
53
  # Expose port
54
  EXPOSE 7860
55
 
56
- # Health check
57
- HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
58
- CMD curl -f http://localhost:7860/health || exit 1
59
-
60
  # Run the application
61
  CMD ["python", "app.py"]
 
1
+ # Use standard Python image - compatible with HF Spaces
2
+ FROM python:3.10
3
 
4
  # Set environment variables
 
5
  ENV PYTHONUNBUFFERED=1
6
+ ENV DEBIAN_FRONTEND=noninteractive
7
 
8
  # Install system dependencies
9
  RUN apt-get update && apt-get install -y \
 
 
 
10
  git \
 
11
  curl \
12
  build-essential \
13
  cmake \
14
  && rm -rf /var/lib/apt/lists/*
15
 
 
 
 
 
16
  # Upgrade pip
17
+ RUN pip install --upgrade pip
18
 
19
  # Set working directory
20
  WORKDIR /app
21
 
22
+ # Copy requirements
23
  COPY requirements.txt .
24
 
25
+ # Install PyTorch with CUDA support
26
+ RUN pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
27
 
28
  # Install llama-cpp-python with CUDA support
29
  ENV CMAKE_ARGS="-DLLAMA_CUBLAS=on"
 
30
  RUN pip install llama-cpp-python --force-reinstall --no-cache-dir
31
 
32
  # Install other requirements
33
  RUN pip install -r requirements.txt
34
 
35
+ # Copy application files
36
  COPY app.py .
37
  COPY README.md .
38
 
39
+ # Create HF cache directory
40
+ RUN mkdir -p /.cache
41
+ ENV HF_HOME=/.cache
42
 
43
  # Expose port
44
  EXPOSE 7860
45
 
 
 
 
 
46
  # Run the application
47
  CMD ["python", "app.py"]