Files
home-information/Dockerfile
Tony C 90b27d73a6 [Bug] Fix ZoneMinder integration stops working - Phase 1 Enhanced Monitoring (#206)
* Fix async synchronization issue in event manager - This seemed to be the root issue all along

Converts _get_new_events() and helper methods to sync to properly work with threading.Lock(). The entire call chain now runs in sync context via sync_to_async(thread_sensitive=True), eliminating the race condition where multiple async tasks bypassed the threading.Lock() protection.

Other improvements:
- Enhance ZoneMinder monitoring to diagnose intermittent failures
- Comprehensive async lifecycle and performance logging
- Added ZM manager locking improvements and thread-local zm clients
- Refactored ZoneMinderManager and HassManager to use new SingletonManager

Closes #205
2025-09-18 23:26:14 +00:00

54 lines
1.6 KiB
Docker

# Pin specific Python version for consistency across platforms
FROM python:3.11.8-bookworm
# Install dependencies with curl for healthcheck
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
curl \
supervisor \
nginx \
redis-server \
redis-tools \
&& mkdir -p /var/log/supervisor \
&& mkdir -p /etc/supervisor/conf.d \
&& rm -rf /var/lib/apt/lists/* \
&& pip install --upgrade pip
WORKDIR /src
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV PYTHONPATH=/src
EXPOSE 8000
VOLUME /data/database /data/media
RUN mkdir -p /data/database && mkdir -p /data/media
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD curl -f http://localhost:8000/health || exit 1
# Assumes base.txt is all that is needed (ignores dev-specific dependencies)
COPY src/hi/requirements/base.txt /src/requirements.txt
RUN pip install --no-cache-dir --root-user-action=ignore -r requirements.txt
COPY package/docker_supervisord.conf /etc/supervisor/conf.d/hi.conf
COPY package/docker_nginx.conf /etc/nginx/sites-available/default
# Clean up nginx default configurations and ensure proper symlinks
RUN rm -f /etc/nginx/conf.d/default.conf \
&& rm -f /etc/nginx/sites-enabled/default \
&& ln -s /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default \
&& nginx -t
COPY package/docker_entrypoint.sh /src/entrypoint.sh
RUN chmod +x /src/entrypoint.sh
COPY HI_VERSION /HI_VERSION
COPY src /src
RUN chmod +x /src/bin/docker-start-gunicorn.sh
ENTRYPOINT ["/src/entrypoint.sh"]
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf" ]