arshtech commited on
Commit
9b2f676
·
verified ·
1 Parent(s): 93fbf04

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +34 -0
Dockerfile ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use official Python runtime as base image
2
+ FROM python:3.9-slim
3
+
4
+ # Set working directory in container
5
+ WORKDIR /app
6
+
7
+ # Install system dependencies
8
+ RUN apt-get update && apt-get install -y \
9
+ libgl1 \
10
+ libglib2.0-0 \
11
+ && rm -rf /var/lib/apt/lists/*
12
+
13
+ # Copy requirements first to leverage Docker cache
14
+ COPY requirements.txt .
15
+
16
+ # Install Python dependencies
17
+ RUN pip install --no-cache-dir -r requirements.txt
18
+
19
+ # Copy application code
20
+ COPY app.py .
21
+ COPY templates/ ./templates/
22
+
23
+ # Create directory for OpenCV Haar cascades
24
+ RUN mkdir -p /usr/share/opencv4/haarcascades/
25
+
26
+ # Expose port
27
+ EXPOSE 5000
28
+
29
+ # Set environment variables
30
+ ENV FLASK_APP=app.py
31
+ ENV FLASK_ENV=production
32
+
33
+ # Run the application
34
+ CMD ["python", "app.py"]