Spaces:
Running
Running
# Use Python 3.11 image (adjust as needed) | |
FROM python:3.11.4-slim | |
# Avoid interactive prompts and set workdir | |
ENV DEBIAN_FRONTEND=noninteractive | |
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 | |
RUN pip install --upgrade pip setuptools wheel build | |
# Force installation of Ultralytics' CLIP fork using legacy build mode | |
RUN pip install --no-use-pep517 git+https://github.com/ultralytics/CLIP.git | |
# (Optional) Rename the installed package folder if it’s installed as "CLIP" | |
# so that later "import clip" succeeds. | |
RUN python -c "import os, site; \ | |
sp = site.getsitepackages()[0]; \ | |
src = os.path.join(sp, 'CLIP'); \ | |
dst = os.path.join(sp, 'clip'); \ | |
print('Looking for', src); \ | |
print('Renaming to', dst) if os.path.exists(src) else print('Not needed'); \ | |
os.rename(src, dst) if os.path.exists(src) else None" | |
# Copy requirements file and install remaining requirements (ensure no CLIP mention here) | |
COPY requirements.txt . | |
RUN pip install --no-cache-dir -r requirements.txt | |
# Copy your app code (if any) | |
COPY . . | |
# Expose port (if using a web server like Gradio) | |
EXPOSE 7860 | |
# Start your app (adjust entrypoint as needed) | |
CMD ["python", "app.py"] | |