notRaphael commited on
Commit
c61bf48
·
verified ·
1 Parent(s): 29f6075

feat: add Dockerfile for containerized REST API deployment

Browse files
Files changed (1) hide show
  1. Dockerfile +22 -0
Dockerfile ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.10-slim
2
+
3
+ WORKDIR /app
4
+
5
+ # System deps for OpenCV
6
+ RUN apt-get update && apt-get install -y --no-install-recommends \
7
+ libgl1-mesa-glx libglib2.0-0 && \
8
+ rm -rf /var/lib/apt/lists/*
9
+
10
+ COPY requirements.txt .
11
+ RUN pip install --no-cache-dir -r requirements.txt fastapi uvicorn python-multipart
12
+
13
+ COPY . .
14
+
15
+ # Health check for orchestrators (K8s, ECS, Docker Compose)
16
+ HEALTHCHECK --interval=30s --timeout=5s --retries=3 \
17
+ CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')" || exit 1
18
+
19
+ EXPOSE 8000
20
+
21
+ # Run the REST API
22
+ CMD ["uvicorn", "video_intelligence.api:app", "--host", "0.0.0.0", "--port", "8000"]