|
|
|
|
|
|
|
|
|
|
|
FROM python:3.11-slim |
|
|
|
|
|
|
|
|
LABEL maintainer="BlackBenAI Team" |
|
|
LABEL description="FireWatch AI - Système de détection d'incendie et d'intrusion" |
|
|
LABEL version="1.1" |
|
|
|
|
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1 |
|
|
ENV PYTHONUNBUFFERED=1 |
|
|
ENV DEBIAN_FRONTEND=noninteractive |
|
|
ENV PORT=7860 |
|
|
|
|
|
|
|
|
WORKDIR /app |
|
|
|
|
|
|
|
|
RUN apt-get update && apt-get install -y \ |
|
|
build-essential \ |
|
|
libpq-dev \ |
|
|
libgl1 \ |
|
|
libglib2.0-0 \ |
|
|
libsm6 \ |
|
|
libxext6 \ |
|
|
libxrender-dev \ |
|
|
libgomp1 \ |
|
|
libgthread-2.0-0 \ |
|
|
libgtk-3-0 \ |
|
|
python3-opencv \ |
|
|
ffmpeg \ |
|
|
wget \ |
|
|
curl \ |
|
|
&& rm -rf /var/lib/apt/lists/* |
|
|
|
|
|
|
|
|
COPY requirements.txt . |
|
|
RUN pip install --no-cache-dir --upgrade pip |
|
|
RUN pip install --no-cache-dir -r requirements.txt |
|
|
|
|
|
|
|
|
RUN useradd -m -u 1000 appuser |
|
|
|
|
|
|
|
|
RUN mkdir -p media/uploads/images media/uploads/videos media/results models logs staticfiles |
|
|
RUN chown -R appuser:appuser /app |
|
|
|
|
|
|
|
|
USER appuser |
|
|
|
|
|
|
|
|
COPY --chown=appuser:appuser . . |
|
|
|
|
|
|
|
|
RUN python manage.py collectstatic --noinput |
|
|
|
|
|
|
|
|
EXPOSE 7860 |
|
|
|
|
|
|
|
|
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \ |
|
|
CMD curl -f http://localhost:7860/ || exit 1 |
|
|
|
|
|
|
|
|
RUN chmod +x /app/docker-entrypoint.sh |
|
|
|
|
|
|
|
|
ENTRYPOINT ["/app/docker-entrypoint.sh"] |
|
|
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "2", "--timeout", "120", "firewatch_project.wsgi:application"] |
|
|
|