|
|
|
|
|
|
| FROM python:3.11-slim
|
|
|
|
|
| ENV DEBIAN_FRONTEND=noninteractive \
|
| PYTHONUNBUFFERED=1 \
|
| PIP_NO_CACHE_DIR=1 \
|
| PORT=7860
|
|
|
| WORKDIR /app
|
|
|
|
|
| RUN apt-get update && apt-get install -y --no-install-recommends \
|
| build-essential \
|
| libgl1 libglib2.0-0 libsm6 libxext6 libxrender-dev \
|
| libpango-1.0-0 libpangocairo-1.0-0 libgdk-pixbuf-xlib-2.0-0 \
|
| libffi-dev shared-mime-info \
|
| ffmpeg \
|
| git \
|
| && rm -rf /var/lib/apt/lists/*
|
|
|
|
|
| RUN pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
|
|
|
|
|
| COPY requirements-docker.txt .
|
|
|
| RUN pip install --no-cache-dir -r requirements-docker.txt \
|
| --extra-index-url https://download.pytorch.org/whl/cpu
|
|
|
|
|
|
|
| ARG DETECTIFAI_BUILD_TS=0
|
|
|
| COPY app.py config.py main_pipeline.py database_video_service.py \
|
| object_detection.py behavior_analysis_integrator.py \
|
| video_captioning_integrator.py event_aggregation.py \
|
| video_segmentation.py highlight_reel.py video_compression.py \
|
| json_reports.py detectifai_events.py facial_recognition.py \
|
| stripe_service.py subscription_middleware.py subscription_routes.py \
|
| alert_routes.py real_time_alerts.py event_clip_generator.py \
|
| extract_upload_keyframes.py live_stream_processor.py \
|
| start_detectifai.py ./
|
|
|
|
|
| COPY core/ core/
|
| COPY database/ database/
|
| COPY report_generation/ report_generation/
|
| COPY video_captioning/ video_captioning/
|
| COPY behavior_analysis/ behavior_analysis/
|
| COPY nlp_search/ nlp_search/
|
| COPY DetectifAI_db/ DetectifAI_db/
|
|
|
|
|
| COPY models/fire_YOLO11.pt models/fire_YOLO11.pt
|
| COPY models/weapon_YOLO11.pt models/weapon_YOLO11.pt
|
| COPY models/merged_fire_knife_gun.pt models/merged_fire_knife_gun.pt
|
| COPY ["models/best (2).pt", "models/best (2).pt"]
|
| COPY models/classifier_svm.pkl models/classifier_svm.pkl
|
| COPY models/label_encoder.pkl models/label_encoder.pkl
|
| COPY models/metadata.json models/metadata.json
|
|
|
|
|
| COPY model/ /app/model/
|
|
|
|
|
| RUN mkdir -p /app/uploads /app/video_processing_outputs /app/logs \
|
| /app/temp_faces /app/report_generation/models \
|
| && chmod -R 777 /app/uploads /app/video_processing_outputs /app/logs /app/temp_faces
|
|
|
|
|
|
|
|
|
|
|
| RUN python -c "\
|
| from huggingface_hub import hf_hub_download; \
|
| print('Downloading fight_detection.pt...'); \
|
| hf_hub_download('blacksinisterx/detectifai-models', 'fight_detection.pt', local_dir='/app/behavior_analysis', local_dir_use_symlinks=False); \
|
| print('Downloading accident_detection.pt...'); \
|
| hf_hub_download('blacksinisterx/detectifai-models', 'accident_detection.pt', local_dir='/app/behavior_analysis', local_dir_use_symlinks=False); \
|
| print('Done with behavior models.'); \
|
| " || echo "WARNING: Could not download behavior models β will retry at startup"
|
|
|
|
|
|
|
|
|
| EXPOSE 7860
|
|
|
|
|
| CMD ["python", "app.py"]
|
|
|