101Frost commited on
Commit
d70e11e
·
verified ·
1 Parent(s): 606d030

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +40 -0
Dockerfile ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.10-slim
2
+
3
+ # Set working directory
4
+ WORKDIR /app
5
+
6
+ # Install system dependencies
7
+ RUN apt-get update && apt-get install -y \
8
+ git \
9
+ build-essential \
10
+ && rm -rf /var/lib/apt/lists/*
11
+
12
+ # Copy requirements first (for better Docker layer caching)
13
+ COPY requirements.txt .
14
+
15
+ # Install Python dependencies (excluding packages we'll install from git)
16
+ RUN pip install --no-cache-dir -r requirements.txt
17
+
18
+ # Clone and install MobileCLIP
19
+ RUN git clone https://github.com/apple/ml-mobileclip.git && \
20
+ cd ml-mobileclip && \
21
+ pip install -e . && \
22
+ cd .. && \
23
+ rm -rf ml-mobileclip/.git
24
+
25
+ # Install packages from git (if you need latest versions)
26
+ RUN pip install git+https://github.com/mlfoundations/open_clip.git
27
+ RUN pip install git+https://github.com/huggingface/pytorch-image-models.git
28
+
29
+ # Copy application code
30
+ COPY app.py .
31
+
32
+ # Expose port
33
+ EXPOSE 7860
34
+
35
+ # Set environment variables
36
+ ENV PYTHONPATH=/app
37
+ ENV PYTHONUNBUFFERED=1
38
+
39
+ # Run the application
40
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]