File size: 1,530 Bytes
5a9cc0f
a25898b
 
5a9cc0f
a25898b
5a9cc0f
 
a25898b
 
c40dd75
a25898b
 
 
 
 
 
 
 
 
 
5a9cc0f
a25898b
 
5a9cc0f
 
 
 
 
 
 
c40dd75
 
5a9cc0f
a25898b
 
 
5a9cc0f
a25898b
 
5a9cc0f
a25898b
 
5a9cc0f
a25898b
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
# Use an official Python 3.11 slim image
FROM python:3.11.4-slim

# Avoid interactive prompts during build
ENV DEBIAN_FRONTEND=noninteractive

# Set working directory
WORKDIR /app

# Install system dependencies (git, build tools, etc.)
RUN apt-get update && apt-get install -y \
    git \
    build-essential \
    ffmpeg \
    libglib2.0-0 \
    libsm6 \
    libxext6 \
    libxrender-dev \
    && rm -rf /var/lib/apt/lists/*

# Upgrade pip, setuptools, wheel, and build tools
RUN pip install --upgrade pip setuptools wheel build

# Force installation of Ultralytics' CLIP fork with legacy build flags
RUN pip install --no-cache-dir --no-build-isolation --no-use-pep517 git+https://github.com/ultralytics/CLIP.git

# Optionally rename installed package folder from "CLIP" to "clip" (for case-sensitive imports)
RUN python -c "import os, site; sp = site.getsitepackages()[0]; \
    src = os.path.join(sp, 'CLIP'); dst = os.path.join(sp, 'clip'); \
    print('Found folder:', src) if os.path.exists(src) else print('Folder not found, skipping renaming'); \
    os.rename(src, dst) if os.path.exists(src) else None"

# Copy requirements file and install remaining dependencies (ensure no duplicate references to CLIP)
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Copy the rest of your application code into the container
COPY . .

# Expose port 7860 (if using a web server like Gradio)
EXPOSE 7860

# Run the application (adjust the command if your entrypoint is different)
CMD ["python", "app.py"]