File size: 940 Bytes
b9f4554
6eb5087
b9f4554
 
 
 
 
 
6eb5087
 
5f0c90f
 
b9f4554
 
 
5f0c90f
b9f4554
 
6eb5087
 
4577c44
6eb5087
b9f4554
6eb5087
 
 
b9f4554
 
6eb5087
5f0c90f
 
6eb5087
b9f4554
 
5f0c90f
b9f4554
5f0c90f
 
 
b9f4554
 
6eb5087
b9f4554
 
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
FROM nvidia/cuda:11.8-runtime-ubuntu22.04

# Set environment variables
ENV PYTHONUNBUFFERED=1
ENV DEBIAN_FRONTEND=noninteractive
ENV CUDA_VISIBLE_DEVICES=0

# Set working directory
WORKDIR /app

# Install system dependencies
RUN apt-get update && apt-get install -y \
    python3 \
    python3-pip \
    python3-venv \
    git \
    wget \
    curl \
    libgl1 \
    libglib2.0-0 \
    && rm -rf /var/lib/apt/lists/*

# Copy requirements first for better caching
COPY requirements.txt .

# Install Python dependencies
RUN pip3 install --no-cache-dir -U pip && \
    pip3 install --no-cache-dir -r requirements.txt

# Copy application code
COPY . .

# Create cache directory for models
RUN mkdir -p /root/.cache/huggingface/hub

# Expose port
EXPOSE 7860

# Health check
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
    CMD curl -f http://localhost:7860 || exit 1

# Run the application
CMD ["python3", "app.py"]