Nighty3912 commited on
Commit
5a9cc0f
·
verified ·
1 Parent(s): c40dd75

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +16 -18
Dockerfile CHANGED
@@ -1,8 +1,10 @@
1
- # Use Python 3.11 image (adjust as needed)
2
  FROM python:3.11.4-slim
3
 
4
- # Avoid interactive prompts and set workdir
5
  ENV DEBIAN_FRONTEND=noninteractive
 
 
6
  WORKDIR /app
7
 
8
  # Install system dependencies (git, build tools, etc.)
@@ -16,31 +18,27 @@ RUN apt-get update && apt-get install -y \
16
  libxrender-dev \
17
  && rm -rf /var/lib/apt/lists/*
18
 
19
- # Upgrade pip, setuptools, wheel, and build
20
  RUN pip install --upgrade pip setuptools wheel build
21
 
22
- # Force installation of Ultralytics' CLIP fork using legacy build mode
23
- RUN pip install --no-use-pep517 git+https://github.com/ultralytics/CLIP.git
24
-
25
- # (Optional) Rename the installed package folder if it’s installed as "CLIP"
26
- # so that later "import clip" succeeds.
27
- RUN python -c "import os, site; \
28
- sp = site.getsitepackages()[0]; \
29
- src = os.path.join(sp, 'CLIP'); \
30
- dst = os.path.join(sp, 'clip'); \
31
- print('Looking for', src); \
32
- print('Renaming to', dst) if os.path.exists(src) else print('Not needed'); \
33
  os.rename(src, dst) if os.path.exists(src) else None"
34
 
35
- # Copy requirements file and install remaining requirements (ensure no CLIP mention here)
36
  COPY requirements.txt .
37
  RUN pip install --no-cache-dir -r requirements.txt
38
 
39
- # Copy your app code (if any)
40
  COPY . .
41
 
42
- # Expose port (if using a web server like Gradio)
43
  EXPOSE 7860
44
 
45
- # Start your app (adjust entrypoint as needed)
46
  CMD ["python", "app.py"]
 
1
+ # Use an official Python 3.11 slim image
2
  FROM python:3.11.4-slim
3
 
4
+ # Avoid interactive prompts during build
5
  ENV DEBIAN_FRONTEND=noninteractive
6
+
7
+ # Set working directory
8
  WORKDIR /app
9
 
10
  # Install system dependencies (git, build tools, etc.)
 
18
  libxrender-dev \
19
  && rm -rf /var/lib/apt/lists/*
20
 
21
+ # Upgrade pip, setuptools, wheel, and build tools
22
  RUN pip install --upgrade pip setuptools wheel build
23
 
24
+ # Force installation of Ultralytics' CLIP fork with legacy build flags
25
+ RUN pip install --no-cache-dir --no-build-isolation --no-use-pep517 git+https://github.com/ultralytics/CLIP.git
26
+
27
+ # Optionally rename installed package folder from "CLIP" to "clip" (for case-sensitive imports)
28
+ RUN python -c "import os, site; sp = site.getsitepackages()[0]; \
29
+ src = os.path.join(sp, 'CLIP'); dst = os.path.join(sp, 'clip'); \
30
+ print('Found folder:', src) if os.path.exists(src) else print('Folder not found, skipping renaming'); \
 
 
 
 
31
  os.rename(src, dst) if os.path.exists(src) else None"
32
 
33
+ # Copy requirements file and install remaining dependencies (ensure no duplicate references to CLIP)
34
  COPY requirements.txt .
35
  RUN pip install --no-cache-dir -r requirements.txt
36
 
37
+ # Copy the rest of your application code into the container
38
  COPY . .
39
 
40
+ # Expose port 7860 (if using a web server like Gradio)
41
  EXPOSE 7860
42
 
43
+ # Run the application (adjust the command if your entrypoint is different)
44
  CMD ["python", "app.py"]