# Camera Station — a self-hosted viewer and recorder for MJPEG and RTSP cameras. # # docker compose up -d # # Everything the service produces (recordings, photos, cameras.json) is written # to /data, which docker-compose.yml maps to ./data on the host so it survives # the container being rebuilt. FROM python:3.12-slim # ffmpeg is the only real dependency, and only RTSP cameras need it. # tini gives the container a real init process, so stopping it delivers a clean # signal and ffmpeg closes the segment it is writing instead of losing it. # tzdata matters more than it looks: filenames are stamped with local time, and # without it the TZ setting is ignored and everything is named in UTC. RUN apt-get update \ && apt-get install -y --no-install-recommends ffmpeg tini tzdata \ && rm -rf /var/lib/apt/lists/* WORKDIR /app COPY server.py index.html config.html library.html ./ ENV CAMERA_STATION_DATA=/data \ PYTHONUNBUFFERED=1 VOLUME ["/data"] EXPOSE 8000 # Report unhealthy if the camera list stops answering. HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \ CMD python3 -c "import urllib.request,sys; sys.exit(0 if urllib.request.urlopen('http://127.0.0.1:8000/cameras', timeout=4).status==200 else 1)" ENTRYPOINT ["/usr/bin/tini", "--"] CMD ["python3", "server.py", "--host", "0.0.0.0", "--port", "8000"]