diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2a8da63 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,56 @@ +FROM debian:buster-slim + +ARG APP_HASH +ARG BUILD_DATE + +LABEL org.label-schema.vcs-ref=$APP_HASH \ + org.label-schema.version=$APP_HASH \ + org.label-schema.vcs-url="https://github.com/domoticz/domoticz" \ + org.label-schema.url="https://domoticz.com/" \ + org.label-schema.name="Domoticz" \ + org.label-schema.description="Domoticz open source Home Automation system" \ + org.label-schema.license="GPLv3" \ + org.label-schema.build-date=$BUILD_DATE \ + maintainer="Domoticz Docker Maintainers " + +WORKDIR /opt/domoticz + +RUN set -ex \ + && apt-get update \ + && apt-get install --no-install-recommends --no-install-suggests -y unzip \ + git \ + libudev-dev \ + libusb-0.1-4 \ + curl libcurl4 libcurl4-gnutls-dev \ + libpython3.7-dev \ + && OS="$(uname -s | sed 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/')" \ + && MACH=$(uname -m) \ + && if [ ${MACH} = "armv6l" ]; then MACH = "armv7l"; fi \ + && archive_file="domoticz_${OS}_${MACH}.tgz" \ + && version_file="version_${OS}_${MACH}.h" \ + && history_file="history_${OS}_${MACH}.txt" \ + && curl -k -L https://releases.domoticz.com/releases/beta/${version_file} --output version.h \ + && curl -k -L https://releases.domoticz.com/releases/beta/${archive_file} --output domoticz.tgz \ + && tar xfz domoticz.tgz \ + && rm domoticz.tgz \ + && apt-get remove --purge --auto-remove -y curl \ + && rm -rf /var/lib/apt/lists/* + +VOLUME /config +VOLUME /opt/domoticz/plugins +VOLUME /log + +EXPOSE 8080 +EXPOSE 443 + +ENV LOG_PATH= +ENV DATABASE_PATH= +ENV WWW_PORT=8080 +ENV SSL_PORT=443 + +COPY docker-entrypoint.sh /usr/local/bin/ +RUN chmod +x /usr/local/bin/docker-entrypoint.sh \ + && ln -s usr/local/bin/docker-entrypoint.sh / # backwards compat + +ENTRYPOINT ["docker-entrypoint.sh"] +CMD ["/opt/domoticz/domoticz"] diff --git a/LICENSE b/License.txt similarity index 99% rename from LICENSE rename to License.txt index f288702..94a9ed0 100644 --- a/LICENSE +++ b/License.txt @@ -1,7 +1,7 @@ GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -645,7 +645,7 @@ the "copyright" line and a pointer to where the full notice is found. GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see . + along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. @@ -664,11 +664,11 @@ might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see -. +. The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read -. +. diff --git a/README.md b/README.md index 3b749b3..15d7d4e 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,72 @@ -# domoticz-docker -Official Domoticz Docker images +Domoticz +====== + +Domoticz - http://www.domoticz.com/ + +Docker containers with official Domoticz (beta) builds + +**THIS IS A WORK IN PROGRESS AND IS NOT FINISHED YET, FEEL FREE TO HELP!** + +## How to use + +**Pull image** + +``` +docker pull domoticz/domoticz:$VERSION + +``` + +**Run container** + +``` +docker run -d \ + -p 8080:8080 \ + -p 8443:443 \ + -v :/config \ + -v /etc/localtime:/etc/localtime:ro \ + --device= \ + --name= \ + domoticz/domoticz:$VERSION +``` + +Please replace all user variables in the above command defined by <> with the correct values (you can have several USB devices attached, just add other `--device=`). + +**Access Domoticz** + +``` +http://:8080 +``` + +8080 can be another port (you change `-p 8080:8080` to `-p 8081:8080` to have 8081 out of the container for example). + +### Usage with docker-compose + +```yaml +version: '3.3' + +services: + domoticz: + image: domoticz/domoticz + container_name: domoticz + restart: unless-stopped + # Pass devices to container + # devices: + # - "dev/serial/by-id/usb-0658_0200-if00:/dev/ttyACM0" + + volumes: + - /etc/localtime:/etc/localtime:ro + #- ./log:/var/log + #- ./config:/config + - ./plugins:/opt/domoticz/plugins + environment: + #ENV LOG_PATH=/var/log/domoticz.log + #ENV DATABASE_PATH=/config/domoticz.db + #ENV WWW_PORT=8080 + #ENV SSL_PORT=443 +``` + +### Building the image + +``` +docker buildx build --no-cache --platform linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/amd64 --build-arg APP_HASH="12345" --build-arg BUILD_DATE="2021-01-29T13:51:00z" --tag domoticz/domoticz . +``` \ No newline at end of file diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh new file mode 100644 index 0000000..5c36ca8 --- /dev/null +++ b/docker-entrypoint.sh @@ -0,0 +1,15 @@ +#!/bin/bash +set -e + +CMD_ARGS="-www $WWW_PORT" +CMD_ARGS="$CMD_ARGS -sslwww $SSL_PORT" + +if [ -n "$LOG_PATH" ]; then + CMD_ARGS="$CMD_ARGS -log $LOG_PATH" +fi + +if [ -n "$DATABASE_PATH" ]; then + CMD_ARGS="$CMD_ARGS -dbase $DATABASE_PATH" +fi + +exec "$@"