diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9e1b65d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +FROM python:3.9-slim + +# Install system dependencies required for OpenCV +RUN apt-get update && apt-get install -y \ + libgl1 \ + libglib2.0-0 \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /app + +# Copy requirements first to leverage Docker cache +COPY requirements.txt . +RUN pip install --no-cache-dir -r requirements.txt + +# Copy application code +COPY . . + +# Expose port 5000 +EXPOSE 5000 + +# Run the application +CMD ["python", "app.py"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..6c582b5 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,14 @@ +version: '3.8' + +services: + people-counter: + build: . + ports: + - "5000:5000" + devices: + - "/dev/video0:/dev/video0" + restart: unless-stopped + # Privileged mode helps with accessing hardware devices if standard mapping fails + privileged: true + environment: + - FLASK_ENV=production