From d3e5194f03a2945c5240d2261da8588bfa6bd783 Mon Sep 17 00:00:00 2001 From: badele Date: Sat, 24 Sep 2016 23:11:39 +0200 Subject: [PATCH] Update docker configuration --- extra/Dockerfile | 9 +++++++-- extra/README.md | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 extra/README.md diff --git a/extra/Dockerfile b/extra/Dockerfile index 4422d67..ac4d5f9 100644 --- a/extra/Dockerfile +++ b/extra/Dockerfile @@ -44,11 +44,13 @@ RUN cd /tmp && \ cp motion /usr/local/bin/motion && \ rm -rf /tmp/motion-mrdave +ARG GIT_REPOSITORY=https://github.com/ccrisan/motioneye.git RUN cd /tmp && \ - git clone https://github.com/ccrisan/motioneye.git && \ + git clone $GIT_REPOSITORY && \ cd /tmp/motioneye && \ python setup.py install && \ mkdir /etc/motioneye && \ + mkdir -p /var/lib/motioneye && \ mkdir -p /usr/share/motioneye/extra && \ cp /tmp/motioneye/extra/motioneye.conf.sample /usr/share/motioneye/extra/motioneye.conf.sample && \ rm -rf /tmp/motioneye @@ -62,6 +64,9 @@ VOLUME /var/run/motion # Video & images VOLUME /var/lib/motion -CMD /usr/local/bin/meyectl startserver -c /etc/motioneye/motioneye.conf +CMD test -e /etc/motioneye/motioneye.conf || \ + cp /usr/share/motioneye/extra/motioneye.conf.sample /etc/motioneye/motioneye.conf ; \ + /usr/local/bin/meyectl startserver -c /etc/motioneye/motioneye.conf + EXPOSE 8765 diff --git a/extra/README.md b/extra/README.md new file mode 100644 index 0000000..a8d91e9 --- /dev/null +++ b/extra/README.md @@ -0,0 +1,38 @@ +motionEye comes with a `Dockerfile` and a sample `docker-compose.yml`, both in the `/extra` directory of the project (https://github.com/ccrisan/motioneye/tree/master/extra). + +### Instructions +1. Download the `Dockerfile` and `docker-compose.yml` either by checking out the motioneye repository, or by downloading them directly from Github. + +2. Build your motionEye Docker image from the `Dockerfile`. First `cd` into the directory where you put the `Dockerfile`. Then: + + # If you would like build docker image from official project + docker build -t motioneye . + + # If you would like build docker image from forked project (ex: from badele github repository) + docker build --build-arg GIT_REPOSITORY=https://github.com/badele/motioneye.git -t motioneye . + +*Note:* If /etc/motioneye/motioneye.conf not exist, it's copied from /usr/share/motioneye/extra/motioneye.conf.sample (Not overwrite the volume) + +3. Have a cup of coffee while the image builds :) + +4. Either start a container using `docker run` or use the provided sample `docker-compose.yml` together with `docker-compose`. + +#### With docker run: + + docker run -d --name=motioneye \ + --device=/dev/video0 + -p 8081:8081 \ + -p 8765:8765 \ + -e TIMEZONE="America/New_York" \ + -v /mnt/motioneye/media:/media \ + -v /mnt/motioneye/config:/etc/motioneye \ + --restart=always \ + motioneye + +#### With docker-compose.yml: + +Edit `docker-compose.yml` and modify the timezone to your own (A list is available at http://php.net/manual/en/timezones.php). + +Also edit the two mount points to a directory in your system. Save the file, and then run: + + docker-compose -f docker-compose.yml -p motioneye up -d -- 2.39.5