chrisxx commited on
Commit
135639b
·
1 Parent(s): 99b7515

python version

Browse files
Files changed (1) hide show
  1. Dockerfile +22 -12
Dockerfile CHANGED
@@ -1,24 +1,34 @@
1
  FROM nvidia/cuda:12.1.0-base-ubuntu22.04
2
 
3
- # Install Python 3.11, pip, and build tools
 
 
 
4
  RUN apt-get update && \
5
- apt-get install -y python3.11 python3.11-dev python3-pip build-essential libevent-dev && \
6
- ln -sf /usr/bin/python3.11 /usr/bin/python && \
7
- ln -sf /usr/bin/pip3 /usr/bin/pip && \
8
- pip install --upgrade pip setuptools wheel && \
9
- rm -rf /var/lib/apt/lists/*
 
 
 
 
 
10
 
11
  WORKDIR /app
12
 
13
- # Install dependencies
14
  COPY requirements.txt .
15
- RUN pip install --no-cache-dir -r requirements.txt && \
16
- python -c "import eventlet; print('eventlet version:', eventlet.__version__)" && \
17
- rm -rf ~/.cache/pip
18
 
19
- # Copy source code
20
  COPY . .
21
 
 
22
  EXPOSE 7860
23
 
24
- CMD ["python", "app.py"]
 
 
1
  FROM nvidia/cuda:12.1.0-base-ubuntu22.04
2
 
3
+ # Prevent interactive prompts during apt installs
4
+ ENV DEBIAN_FRONTEND=noninteractive
5
+
6
+ # Install Python 3.11, pip, and minimal build tools
7
  RUN apt-get update && \
8
+ apt-get install -y --no-install-recommends \
9
+ python3.11 \
10
+ python3.11-venv \
11
+ python3.11-dev \
12
+ python3-pip \
13
+ build-essential \
14
+ libevent-dev \
15
+ && python3.11 -m pip install --upgrade pip setuptools wheel \
16
+ && apt-get clean \
17
+ && rm -rf /var/lib/apt/lists/*
18
 
19
  WORKDIR /app
20
 
21
+ # Copy dependency list and install using Python 3.11 explicitly
22
  COPY requirements.txt .
23
+ RUN python3.11 -m pip install --no-cache-dir -r requirements.txt \
24
+ && python3.11 -c "import eventlet; print('eventlet version:', eventlet.__version__)" \
25
+ && rm -rf ~/.cache/pip
26
 
27
+ # Copy source code last (better layer caching)
28
  COPY . .
29
 
30
+ # Expose the port expected by Hugging Face Spaces
31
  EXPOSE 7860
32
 
33
+ # Run the app explicitly with Python 3.11 to avoid system default mismatches
34
+ CMD ["python3.11", "app.py"]