File size: 1,024 Bytes
bbfbff4
809c7db
 
 
bbfbff4
30cc679
 
bbfbff4
eee63a4
30cc679
eee63a4
809c7db
eee63a4
 
 
 
bbfbff4
 
eee63a4
 
0b6aecc
bbfbff4
eee63a4
 
 
809c7db
 
 
 
 
 
 
 
0b6aecc
 
 
 
 
 
 
809c7db
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
FROM nvidia/cuda:12.1.0-runtime-ubuntu22.04

WORKDIR /app

# Fix environment variables
ENV OMP_NUM_THREADS=4
ENV MKL_NUM_THREADS=4
ENV DEBIAN_FRONTEND=noninteractive
ENV PATH="/usr/local/bin:$PATH"

# Install Python 3.11 and pip properly
RUN apt-get update && apt-get install -y \
    software-properties-common \
    && add-apt-repository -y ppa:deadsnakes/ppa \
    && apt-get update \
    && apt-get install -y \
    python3.11 \
    python3.11-venv \
    python3.11-distutils \
    curl \
    git \
    && rm -rf /var/lib/apt/lists/* \
    && ln -sf /usr/bin/python3.11 /usr/bin/python \
    && ln -sf /usr/bin/python3.11 /usr/bin/python3 \
    && curl -sS https://bootstrap.pypa.io/get-pip.py | python3.11

# Copy requirements and install
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Copy app
COPY . .

# Create user for HF Space
RUN useradd -m -u 1000 user
USER user

# Set HF cache directory
ENV HF_HOME=/tmp/huggingface

# Expose port
EXPOSE 7860

# Run app
CMD ["python", "app.py"]