File size: 1,136 Bytes
5a729af
 
 
 
98bf2c9
 
 
 
 
 
5a729af
 
 
98bf2c9
 
 
 
 
 
5a729af
98bf2c9
5a729af
 
98bf2c9
 
 
 
 
 
 
 
 
 
5a729af
 
98bf2c9
 
 
5a729af
98bf2c9
5a729af
98bf2c9
 
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 python:3.10-slim

WORKDIR /code

# Set environment variable to disable pip cache
ENV PIP_NO_CACHE_DIR=1

# Install system dependencies with cleanup
RUN apt-get update && \
    apt-get install -y --no-install-recommends \
    build-essential \
    libgl1-mesa-glx \
    libglib2.0-0 \
    git \
    && apt-get clean && \
    rm -rf /var/lib/apt/lists/* && \
    rm -rf /tmp/* && \
    mkdir -p /tmp && \
    chmod 777 /tmp

# Copy requirements first
COPY requirements.txt .

# Install dependencies with improved error handling
RUN pip install --no-cache-dir --upgrade pip && \
    pip install --no-cache-dir setuptools wheel && \
    pip install --no-cache-dir -r requirements.txt || (echo "pip install failed" && exit 1) && \
    rm -rf ~/.cache/pip && \
    rm -rf /tmp/* && \
    mkdir -p /tmp && \
    chmod 777 /tmp

# Copy application code
COPY . .

# Create necessary directories with proper permissions
RUN mkdir -p /tmp/models/parts/weights/weights && \
    chmod -R 777 /tmp

EXPOSE 7860

# Added --reload flag for development convenience
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860", "--reload"]