FLODARELTIH commited on
Commit
f0f6622
·
verified ·
1 Parent(s): e77de6c

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +39 -0
Dockerfile ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Dockerfile
2
+ FROM python:3.9-slim
3
+
4
+ # Set working directory
5
+ WORKDIR /app
6
+
7
+ # Install system dependencies for OpenCV and insightface
8
+ RUN apt-get update && apt-get install -y \
9
+ libgl1-mesa-glx \
10
+ libglib2.0-0 \
11
+ libsm6 \
12
+ libxext6 \
13
+ libxrender-dev \
14
+ libgomp1 \
15
+ wget \
16
+ && rm -rf /var/lib/apt/lists/*
17
+
18
+ # Copy requirements first for better caching
19
+ COPY requirements.txt .
20
+
21
+ # Install Python dependencies
22
+ RUN pip install --no-cache-dir -r requirements.txt
23
+
24
+ # Download the inswapper_128.onnx model
25
+ RUN wget -O /app/inswapper_128.onnx https://github.com/deepinsight/insightface/releases/download/v0.7/inswapper_128.onnx || \
26
+ echo "Please download inswapper_128.onnx manually and place in /app directory"
27
+
28
+ # Copy application code
29
+ COPY app.py .
30
+
31
+ # Expose port
32
+ EXPOSE 7860
33
+
34
+ # Health check
35
+ HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
36
+ CMD python -c "import requests; requests.get('http://localhost:5000/health')" || exit 1
37
+
38
+ # Run the application
39
+ CMD ["python", "app.py"]