From 67c5628cbb3221e2932aea96bdafcb5f47cdfed4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=B6ppner?= Date: Sun, 18 Sep 2022 13:06:59 +0200 Subject: [PATCH 01/35] Remove unused file --- smarthomeng-knx-common.sh | 80 --------------------------------------- 1 file changed, 80 deletions(-) delete mode 100644 smarthomeng-knx-common.sh diff --git a/smarthomeng-knx-common.sh b/smarthomeng-knx-common.sh deleted file mode 100644 index b57bbc7..0000000 --- a/smarthomeng-knx-common.sh +++ /dev/null @@ -1,80 +0,0 @@ -ACTION=$1 - -DOCKER_REPOSITORY_ID=smarthomeng -DOCKER_REPOSITORY=smarthome-ng -VERSION=1.7.2 - -IMAGE=$DOCKER_REPOSITORY_ID/$DOCKER_REPOSITORY:$VERSION -IMAGE_LATEST_TAG=$DOCKER_REPOSITORY_ID/$DOCKER_REPOSITORY:latest - -CONTAINER_NAME=smarthomeng - -smarthomengconfig=~/knx/visu/docker-configs/smarthome-ng-config - -if [ -z "$ACTION" ]; - then - echo "usage: $0 "; - exit 1; -fi - -_build() { - # Build - docker build -t $IMAGE -t $IMAGE_LATEST_TAG . -} - -_tag() { - # tag => $ docker tag local-image:tagname reponame:tagname - docker tag $IMAGE $IMAGE_LATEST_TAG -} - -_push() { - # $ docker push reponame:tagname - docker push $IMAGE && docker push $IMAGE_LATEST_TAG -} - -_run() { - # Run (first time) - docker run -d \ - -p 2323:2323 \ - -p 2424:2424 \ - -p 8383:8383 \ - -v $smarthomengconfig/etc:/usr/local/smarthome/etc \ - -v $smarthomengconfig/items:/usr/local/smarthome/items \ - -v $smarthomengconfig/logics:/usr/local/smarthome/logics \ - -v $smarthomengconfig/scenes:/usr/local/smarthome/scenes \ - -v $smarthomengconfig/var:/usr/local/smarthome/var \ - # -v /dev/ttyUSB0:/dev/ttyUSB0 \ - --name=$CONTAINER_NAME \ - -it $IMAGE -} - -_stop() { - # Stop - docker stop $CONTAINER_NAME -} - -_start() { - # Start (after stopping) - docker start $CONTAINER_NAME -} - -_remove() { - # Remove - docker rm $CONTAINER_NAME -} - -_rerun() { - _stop - _remove - _run -} - -_attach() { - docker exec -ti $CONTAINER_NAME bash -} - -_logs() { - docker logs $CONTAINER_NAME -} - -eval _$ACTION From d3cfcc4b02a59c8345070770c746e123ca262a24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=B6ppner?= Date: Sun, 18 Sep 2022 13:18:05 +0200 Subject: [PATCH 02/35] Fix typo "smarthomNG" --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index b0a1f7d..400c5a0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -35,7 +35,7 @@ RUN set -eux; \ for i in $PLGN_DEL; do rm -rf plugins/$i; done; \ fi -### Build Stage 11 - determine requirements for smarthomNG ####################### +### Build Stage 11 - determine requirements for smarthomeNG ####################### FROM stage1 As stage2 ARG PLGN_CONFLICT="appletv hue2" @@ -51,7 +51,7 @@ RUN set -eux; \ # create requirement files python3 bin/smarthome.py --stop -### Build Stage 3 - build requirements for smarthomNG ########################### +### Build Stage 3 - build requirements for smarthomeNG ########################### FROM python-base As stage3 COPY --from=stage2 /usr/local/smarthome/requirements/all.txt /requirements.txt From 1ca73e8f47d819d5e00c831def0ca5248771668e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=B6ppner?= Date: Sun, 18 Sep 2022 13:21:11 +0200 Subject: [PATCH 03/35] Update versions to 1.9.2 and assign repos as vars --- Dockerfile | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 400c5a0..fcd89b6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,18 +12,20 @@ RUN set -eux; apt-get update; apt-get install -y --no-install-recommends \ rm -rf /var/lib/apt/lists/* # prepare clone -ARG SHNG_VER_CORE="v1.9.1" \ - SHNG_VER_PLGN="v1.9.1" \ - PLGN_DEL="gpio" +ARG SHNG_VER_CORE="v1.9.2" \ + SHNG_VER_PLGN="v1.9.2" \ + SHNG_REPO_CORE="https://github.com/smarthomeNG/smarthome.git" \ + SHNG_REPO_PLGN="https://github.com/smarthomeNG/plugins.git" \ + PLGN_DEL="gpio zwave" # clone smarthomeNG from Git WORKDIR /usr/local/smarthome RUN set -eux; \ # clone SmarthomeNG git -c advice.detachedHead=false clone --single-branch --branch $SHNG_VER_CORE \ - https://github.com/smarthomeNG/smarthome.git .; \ + $SHNG_REPO_CORE .; \ git -c advice.detachedHead=false clone --single-branch --branch $SHNG_VER_PLGN \ - https://github.com/smarthomeNG/plugins.git plugins; \ + $SHNG_REPO_PLGN plugins; \ # remove git files - not usefull inside a container find . -name ".git*" -print -exec rm -rf {} +; \ find . -name ".*" -type f -print -exec rm -rf {} +; \ From 4d31a1efbf5e7e0fd0dfd659fa51586029fb2930 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=B6ppner?= Date: Sun, 18 Sep 2022 13:28:19 +0200 Subject: [PATCH 04/35] Bugfix: Store config templates to correct folder --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 403f713..c2563c8 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -28,7 +28,7 @@ if [ -f $PATH_SHNG/etc/.not_mounted ]; then WARN_MOUNT_CONF="${WARN_MOUNT_CONF# } $i" elif [ ! -f $PATH_CONF/$i/.files_created ]; then mkdir -p $PATH_CONF/$i - cp -vnr $PATH_SHNG/$i/* $PATH_CONF + cp -vnr $PATH_SHNG/$i/* $PATH_CONF/$i touch $PATH_CONF/$i/.files_created fi done From f13b40a0ccfa63c55931b22130a88cc869f8b50d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=B6ppner?= Date: Sun, 18 Sep 2022 13:38:45 +0200 Subject: [PATCH 05/35] Download plugins to 'default'-folder and merge them on startup to allow public plugins folder --- Dockerfile | 10 ++++++---- entrypoint.sh | 30 ++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index fcd89b6..6189d56 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,7 +25,7 @@ RUN set -eux; \ git -c advice.detachedHead=false clone --single-branch --branch $SHNG_VER_CORE \ $SHNG_REPO_CORE .; \ git -c advice.detachedHead=false clone --single-branch --branch $SHNG_VER_PLGN \ - $SHNG_REPO_PLGN plugins; \ + $SHNG_REPO_PLGN plugins-default; \ # remove git files - not usefull inside a container find . -name ".git*" -print -exec rm -rf {} +; \ find . -name ".*" -type f -print -exec rm -rf {} +; \ @@ -34,7 +34,7 @@ RUN set -eux; \ find . -name "*.md" -print -exec rm -rf {} +; \ # remove plugins if they are not running - for example GPIO is RasPi specific if [ "$PLGN_DEL" ]; then \ - for i in $PLGN_DEL; do rm -rf plugins/$i; done; \ + for i in $PLGN_DEL; do rm -rf plugins-default/$i; done; \ fi ### Build Stage 11 - determine requirements for smarthomeNG ####################### @@ -44,12 +44,14 @@ ARG PLGN_CONFLICT="appletv hue2" WORKDIR /usr/local/smarthome RUN set -eux; \ -# remove some plugins to remove there requirements +# remove some plugins to remove their requirements if [ "$PLGN_CONFLICT" ]; then \ - for i in $PLGN_CONFLICT; do rm -rf plugins/$i; done; \ + for i in $PLGN_CONFLICT; do rm -rf plugins-default/$i; done; \ fi; \ # necessary to run smarthome.py python -m pip install --no-cache-dir ruamel.yaml; \ +# create links from the default plugins-folder to the to be used one. + cp -alr plugins-default plugins; \ # create requirement files python3 bin/smarthome.py --stop diff --git a/entrypoint.sh b/entrypoint.sh index c2563c8..945a46a 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -5,6 +5,9 @@ SHNG_ARG=$@ PATH_SHNG=/usr/local/smarthome PATH_CONF=/mnt/conf PATH_DATA=/mnt/data +PATH_PLGN_USER=/mnt/plugins +PATH_PLGN_TRGT=/usr/local/smarthome/plugins +PATH_PLGN_DFLT=/usr/local/smarthome/plugins-default PATH_HTML=/mnt/html DIRS_CONF="etc items logics scenes functions" DIRS_DATA="backup restore cache db log" @@ -126,6 +129,33 @@ if [ "$USER_SHNG" ]; then fi fi +#merge plugins appropriately +cp -alr $PATH_PLGN_DFLT $PATH_PLGN_TRGT + +if [ -d $PATH_PLGN_USER ]; then + if [ -f $PATH_PLGN_USER/download_plugins.sh ]; then + $PATH_PLGN_USER/download_plugins.sh || download_plugins_result=$? + fi + shopt -s extglob nullglob + # take all plugin-folders in the custom folder + PLUGINS_FROM_CUSTOM=( "$PATH_PLGN_USER"/*/ ) + # remove leading basedir + PLUGINS_FROM_CUSTOM=( "${PLUGINS_FROM_CUSTOM[@]#"$PATH_PLGN_USER/"}" ) + # remove trailing slash + PLUGINS_FROM_CUSTOM=( "${PLUGINS_FROM_CUSTOM[@]%/}" ) + + for i in "${!PLUGINS_FROM_CUSTOM[@]}"; do + if [ -d $PATH_PLGN_TRGT/${PLUGINS_FROM_CUSTOM[i]} ]; then + _print INFO Overwriting Plugin ${PLUGINS_FROM_CUSTOM[i]} + rm -rf $PATH_PLGN_TRGT/${PLUGINS_FROM_CUSTOM[i]} + else + _print INFO Copying Plugin ${PLUGINS_FROM_CUSTOM[i]} + fi + cp -vr "$PATH_PLGN_USER/${PLUGINS_FROM_CUSTOM[i]}" "$PATH_PLGN_TRGT/${PLUGINS_FROM_CUSTOM[i]}/" + touch $PATH_PLGN_TRGT/${PLUGINS_FROM_CUSTOM[i]}/.from_custom + done +fi + # start SmartHomeNG cd $PATH_SHNG if [ "$USER_SHNG" ]; then From e2f99fa57c182c8262b8c75b3c770a021e5e03d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=B6ppner?= Date: Sun, 18 Sep 2022 13:46:32 +0200 Subject: [PATCH 06/35] Add pymysql to dynamically created requirements.txt --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 6189d56..9fe0855 100644 --- a/Dockerfile +++ b/Dockerfile @@ -79,7 +79,8 @@ RUN set -eux; \ rm -rf /var/lib/apt/lists/*; \ # fix python requirements echo "holidays<0.13" >>/requirements.txt; \ - #sed -e 's/^\(holidays.*\)/\1,<=0.12;python_version==3.8/g' lib/requirements.txt; \ +# Add pymysql + echo "pymysql" >>/requirements.txt; \ # install python requirements python -m pip install --no-cache-dir -r requirements.txt From 80428f5bcc5ee86341943b30d84c6f99a6fb546d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=B6ppner?= Date: Sun, 18 Sep 2022 15:37:23 +0200 Subject: [PATCH 07/35] Do not delete zwave plugin --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 9fe0855..b29692c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,7 +16,7 @@ ARG SHNG_VER_CORE="v1.9.2" \ SHNG_VER_PLGN="v1.9.2" \ SHNG_REPO_CORE="https://github.com/smarthomeNG/smarthome.git" \ SHNG_REPO_PLGN="https://github.com/smarthomeNG/plugins.git" \ - PLGN_DEL="gpio zwave" + PLGN_DEL="gpio" # clone smarthomeNG from Git WORKDIR /usr/local/smarthome From 3f01cfe8f61a9a0f1907690c1948ffa559b07cfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=B6ppner?= Date: Sun, 18 Sep 2022 16:14:54 +0200 Subject: [PATCH 08/35] Make entrypoint and wrapper executable --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index b29692c..5711650 100644 --- a/Dockerfile +++ b/Dockerfile @@ -139,7 +139,7 @@ RUN set -eux; \ EXPOSE 2323 2424 8383 # and finalize -#COPY ./entrypoint.sh ./shng_wrapper.sh / -COPY * / +COPY ./entrypoint.sh ./shng_wrapper.sh / +RUN chmod +x ./entrypoint.sh; chmod +x ./shng_wrapper.sh ENTRYPOINT ["/entrypoint.sh"] CMD ["--foreground"] From 2e627676790c003ecfa9c72827b763f0ff4c03a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=B6ppner?= Date: Wed, 26 Oct 2022 20:16:36 +0200 Subject: [PATCH 09/35] Enable handling of mounted plugins --- entrypoint.sh | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 945a46a..80e7837 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -130,7 +130,23 @@ if [ "$USER_SHNG" ]; then fi #merge plugins appropriately -cp -alr $PATH_PLGN_DFLT $PATH_PLGN_TRGT +if [ -d $PATH_PLGN_TRGT ]; then + # if Plugin folder is already there specific plugins were mounted from outside + shopt -s extglob nullglob + # take all plugin-folders in the custom folder + PLUGINS_FROM_DEFAULT=( "$PATH_PLGN_DFLT"/*/ ) + # remove leading basedir + PLUGINS_FROM_DEFAULT=( "${PLUGINS_FROM_DEFAULT[@]#"$PATH_PLGN_DFLT/"}" ) + # remove trailing slash + PLUGINS_FROM_DEFAULT=( "${PLUGINS_FROM_DEFAULT[@]%/}" ) + for i in "${!PLUGINS_FROM_DEFAULT[@]}"; do + if [ -d $PATH_PLGN_TRGT/${PLUGINS_FROM_CUSTOM[i]} ]; then + _print INFO Plugin already mounted here ${PLUGINS_FROM_DEFAULT[i]} + else + cp -alr "$PATH_PLGN_DFLT/${PLUGINS_FROM_CUSTOM[i]}" "$PATH_PLGN_TRGT/${PLUGINS_FROM_CUSTOM[i]}" +else + cp -alr $PATH_PLGN_DFLT $PATH_PLGN_TRGT +fi if [ -d $PATH_PLGN_USER ]; then if [ -f $PATH_PLGN_USER/download_plugins.sh ]; then From 8815486c8391b31aeeb032106892c9f9b8e679a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=B6ppner?= Date: Wed, 26 Oct 2022 20:17:44 +0200 Subject: [PATCH 10/35] Fix broken entrypoint --- entrypoint.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/entrypoint.sh b/entrypoint.sh index 80e7837..9b350ae 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -144,6 +144,8 @@ if [ -d $PATH_PLGN_TRGT ]; then _print INFO Plugin already mounted here ${PLUGINS_FROM_DEFAULT[i]} else cp -alr "$PATH_PLGN_DFLT/${PLUGINS_FROM_CUSTOM[i]}" "$PATH_PLGN_TRGT/${PLUGINS_FROM_CUSTOM[i]}" + fi + done else cp -alr $PATH_PLGN_DFLT $PATH_PLGN_TRGT fi From 06a776fd38decc1b4222b8688ca29181712af56e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=B6ppner?= Date: Wed, 26 Oct 2022 20:32:02 +0200 Subject: [PATCH 11/35] Create main.yml --- .github/workflows/main.yml | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..a6b6cba --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,37 @@ +# This is a basic workflow to help you get started with Actions + +name: Build-Publish + +# Controls when the workflow will run +on: + push: + tags: + - 'v*.*.*' + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Login to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_ACCESS_TOKEN }} + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + file: ./Dockerfile + push: true + tags: ${{ secrets.DOCKER_USERNAME }}/smarthomeng:${{github.ref_name }} From acddb7858c6b3a164c7c1be4b85bd4006301c896 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=B6ppner?= Date: Wed, 26 Oct 2022 20:36:28 +0200 Subject: [PATCH 12/35] Enable Auto-Building using GitHub Actions --- .github/workflows/main.yml | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..b659c53 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,37 @@ +# This is a basic workflow to help you get started with Actions + +name: Build-Publish + +# Controls when the workflow will run +on: + push: + tags: + - 'v*.*.*' + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Login to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_ACCESS_TOKEN }} + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + file: ./Dockerfile + push: true + tags: ${{ secrets.DOCKER_USERNAME }}/smarthomeng:${{github.ref_name }} \ No newline at end of file From b4672c80b5e83b596ef6d388896617b86890fe9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=B6ppner?= Date: Wed, 26 Oct 2022 20:36:40 +0200 Subject: [PATCH 13/35] Upgrade to Python 3.9 --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 5711650..248ef82 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ ### dockerfile for smarthomNG flavor "full" ### select python base image #################################################### -FROM python:3.8-slim As python-base +FROM python:3.9-slim As python-base ### Build Stage 1 - clone smarthome NG from Git ################################# FROM python-base As stage1 From 92f29a000a4a08bf3c344106203e028e8fbfdc88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=B6ppner?= Date: Sat, 29 Oct 2022 17:37:58 +0200 Subject: [PATCH 14/35] Remove incompatible zwave Plugin --- Dockerfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 248ef82..2fda5be 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,7 +16,7 @@ ARG SHNG_VER_CORE="v1.9.2" \ SHNG_VER_PLGN="v1.9.2" \ SHNG_REPO_CORE="https://github.com/smarthomeNG/smarthome.git" \ SHNG_REPO_PLGN="https://github.com/smarthomeNG/plugins.git" \ - PLGN_DEL="gpio" + PLGN_DEL="gpio zwave" # clone smarthomeNG from Git WORKDIR /usr/local/smarthome @@ -72,10 +72,10 @@ RUN set -eux; \ #rrd librrd-dev \ #pyjq - libtool \ + libtool; \ #openzwave - libudev-dev \ - openzwave; \ + ## libudev-dev \ + ## openzwave; \ rm -rf /var/lib/apt/lists/*; \ # fix python requirements echo "holidays<0.13" >>/requirements.txt; \ From 21c4bba2442b02ab30900d1e07bceaa659fa9c28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=B6ppner?= Date: Sat, 29 Oct 2022 17:57:56 +0200 Subject: [PATCH 15/35] Fixed wrong paths for premounted plugins --- entrypoint.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 9b350ae..76744e2 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -140,12 +140,14 @@ if [ -d $PATH_PLGN_TRGT ]; then # remove trailing slash PLUGINS_FROM_DEFAULT=( "${PLUGINS_FROM_DEFAULT[@]%/}" ) for i in "${!PLUGINS_FROM_DEFAULT[@]}"; do - if [ -d $PATH_PLGN_TRGT/${PLUGINS_FROM_CUSTOM[i]} ]; then + if [ -d $PATH_PLGN_TRGT/${PLUGINS_FROM_DEFAULT[i]} ]; then _print INFO Plugin already mounted here ${PLUGINS_FROM_DEFAULT[i]} else - cp -alr "$PATH_PLGN_DFLT/${PLUGINS_FROM_CUSTOM[i]}" "$PATH_PLGN_TRGT/${PLUGINS_FROM_CUSTOM[i]}" + cp -alr "$PATH_PLGN_DFLT/${PLUGINS_FROM_DEFAULT[i]}" "$PATH_PLGN_TRGT/${PLUGINS_FROM_DEFAULT[i]}" fi done + # copy root files as well + cp -al $PATH_PLGN_DFLT/* $PATH_PLGN_TRGT/ else cp -alr $PATH_PLGN_DFLT $PATH_PLGN_TRGT fi From c2a953090705fb24741102c97c40152670e7f85d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=B6ppner?= Date: Sun, 30 Oct 2022 10:53:13 +0100 Subject: [PATCH 16/35] Altered present plugin folder merge-logic --- entrypoint.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 76744e2..5d3960e 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -147,7 +147,11 @@ if [ -d $PATH_PLGN_TRGT ]; then fi done # copy root files as well - cp -al $PATH_PLGN_DFLT/* $PATH_PLGN_TRGT/ + if [ -d $PATH_PLGN_TRGT ]; then + _print INFO __init__.py exists in plugin-folder + else + cp $PATH_PLGN_DFLT/__init__.py $PATH_PLGN_TRGT/ + fi else cp -alr $PATH_PLGN_DFLT $PATH_PLGN_TRGT fi From d1a6b077f028f6afd2a35f047d18bbc841b2a6c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=B6ppner?= Date: Sun, 30 Oct 2022 11:16:29 +0100 Subject: [PATCH 17/35] Correct logic to copy __init__.py / add build on every push --- .github/workflows/anypush.yml | 37 +++++++++++++++++++++++++++++++++++ .github/workflows/main.yml | 2 +- entrypoint.sh | 5 ++--- 3 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/anypush.yml diff --git a/.github/workflows/anypush.yml b/.github/workflows/anypush.yml new file mode 100644 index 0000000..07f4098 --- /dev/null +++ b/.github/workflows/anypush.yml @@ -0,0 +1,37 @@ +# This is a basic workflow to help you get started with Actions + +name: Build-Publish-Any + +# Controls when the workflow will run +on: + push: + branches: + - publish + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Login to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_ACCESS_TOKEN }} + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + file: ./Dockerfile + push: true + tags: ${{ secrets.DOCKER_USERNAME }}/smarthomeng:develop diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a6b6cba..4d0dd72 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,6 +1,6 @@ # This is a basic workflow to help you get started with Actions -name: Build-Publish +name: Build-Publish-Release # Controls when the workflow will run on: diff --git a/entrypoint.sh b/entrypoint.sh index 5d3960e..09e511c 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -147,9 +147,8 @@ if [ -d $PATH_PLGN_TRGT ]; then fi done # copy root files as well - if [ -d $PATH_PLGN_TRGT ]; then - _print INFO __init__.py exists in plugin-folder - else + if [ ! -f $PATH_PLGN_DFLT/__init__.py ]; then + _print INFO __init__.py did not exist in plugin-folder, so it is now put there cp $PATH_PLGN_DFLT/__init__.py $PATH_PLGN_TRGT/ fi else From 1414ba0dde11bfa177ef15e8c44f546499e9b78a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=B6ppner?= Date: Sun, 30 Oct 2022 11:40:17 +0100 Subject: [PATCH 18/35] Fix path plugin for __init__.py check --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 09e511c..e88ced2 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -147,7 +147,7 @@ if [ -d $PATH_PLGN_TRGT ]; then fi done # copy root files as well - if [ ! -f $PATH_PLGN_DFLT/__init__.py ]; then + if [ ! -f $PATH_PLGN_TRGT/__init__.py ]; then _print INFO __init__.py did not exist in plugin-folder, so it is now put there cp $PATH_PLGN_DFLT/__init__.py $PATH_PLGN_TRGT/ fi From c43bef2c96de60e5ed990923b259e819d48417c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=B6ppner?= Date: Sun, 30 Oct 2022 11:53:20 +0100 Subject: [PATCH 19/35] Actions: Apply tag latest (Docker) on each tag (Github) --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4d0dd72..0153684 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -34,4 +34,4 @@ jobs: context: . file: ./Dockerfile push: true - tags: ${{ secrets.DOCKER_USERNAME }}/smarthomeng:${{github.ref_name }} + tags: ${{ secrets.DOCKER_USERNAME }}/smarthomeng:${{github.ref_name }},${{ secrets.DOCKER_USERNAME }}/smarthomeng:latest From f387c36d6a6e6c328b4b1a3cb45af313cf98554d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=B6ppner?= Date: Sun, 6 Nov 2022 16:57:11 +0100 Subject: [PATCH 20/35] Ensure plugins are only merged if no plugins-folder is mounted from outside --- entrypoint.sh | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index e88ced2..0e6a304 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -131,7 +131,7 @@ fi #merge plugins appropriately if [ -d $PATH_PLGN_TRGT ]; then - # if Plugin folder is already there specific plugins were mounted from outside + # if Plugin folder is already there, specific plugins were mounted from outside shopt -s extglob nullglob # take all plugin-folders in the custom folder PLUGINS_FROM_DEFAULT=( "$PATH_PLGN_DFLT"/*/ ) @@ -152,31 +152,31 @@ if [ -d $PATH_PLGN_TRGT ]; then cp $PATH_PLGN_DFLT/__init__.py $PATH_PLGN_TRGT/ fi else + # if plugin-folder is not yet available, build new one and merge plugins cp -alr $PATH_PLGN_DFLT $PATH_PLGN_TRGT -fi + if [ -d $PATH_PLGN_USER ]; then + if [ -f $PATH_PLGN_USER/download_plugins.sh ]; then + $PATH_PLGN_USER/download_plugins.sh || download_plugins_result=$? + fi + shopt -s extglob nullglob + # take all plugin-folders in the custom folder + PLUGINS_FROM_CUSTOM=( "$PATH_PLGN_USER"/*/ ) + # remove leading basedir + PLUGINS_FROM_CUSTOM=( "${PLUGINS_FROM_CUSTOM[@]#"$PATH_PLGN_USER/"}" ) + # remove trailing slash + PLUGINS_FROM_CUSTOM=( "${PLUGINS_FROM_CUSTOM[@]%/}" ) -if [ -d $PATH_PLGN_USER ]; then - if [ -f $PATH_PLGN_USER/download_plugins.sh ]; then - $PATH_PLGN_USER/download_plugins.sh || download_plugins_result=$? + for i in "${!PLUGINS_FROM_CUSTOM[@]}"; do + if [ -d $PATH_PLGN_TRGT/${PLUGINS_FROM_CUSTOM[i]} ]; then + _print INFO Overwriting Plugin ${PLUGINS_FROM_CUSTOM[i]} + rm -rf $PATH_PLGN_TRGT/${PLUGINS_FROM_CUSTOM[i]} + else + _print INFO Copying Plugin ${PLUGINS_FROM_CUSTOM[i]} + fi + cp -vr "$PATH_PLGN_USER/${PLUGINS_FROM_CUSTOM[i]}" "$PATH_PLGN_TRGT/${PLUGINS_FROM_CUSTOM[i]}/" + touch $PATH_PLGN_TRGT/${PLUGINS_FROM_CUSTOM[i]}/.from_custom + done fi - shopt -s extglob nullglob - # take all plugin-folders in the custom folder - PLUGINS_FROM_CUSTOM=( "$PATH_PLGN_USER"/*/ ) - # remove leading basedir - PLUGINS_FROM_CUSTOM=( "${PLUGINS_FROM_CUSTOM[@]#"$PATH_PLGN_USER/"}" ) - # remove trailing slash - PLUGINS_FROM_CUSTOM=( "${PLUGINS_FROM_CUSTOM[@]%/}" ) - - for i in "${!PLUGINS_FROM_CUSTOM[@]}"; do - if [ -d $PATH_PLGN_TRGT/${PLUGINS_FROM_CUSTOM[i]} ]; then - _print INFO Overwriting Plugin ${PLUGINS_FROM_CUSTOM[i]} - rm -rf $PATH_PLGN_TRGT/${PLUGINS_FROM_CUSTOM[i]} - else - _print INFO Copying Plugin ${PLUGINS_FROM_CUSTOM[i]} - fi - cp -vr "$PATH_PLGN_USER/${PLUGINS_FROM_CUSTOM[i]}" "$PATH_PLGN_TRGT/${PLUGINS_FROM_CUSTOM[i]}/" - touch $PATH_PLGN_TRGT/${PLUGINS_FROM_CUSTOM[i]}/.from_custom - done fi # start SmartHomeNG From dc49588aa4fc4a049ff110f4eb8d1064b6cf116a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=B6ppner?= Date: Sun, 6 Nov 2022 16:57:42 +0100 Subject: [PATCH 21/35] Upgrade to v1.9.3 --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2fda5be..4e87b6d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,8 +12,8 @@ RUN set -eux; apt-get update; apt-get install -y --no-install-recommends \ rm -rf /var/lib/apt/lists/* # prepare clone -ARG SHNG_VER_CORE="v1.9.2" \ - SHNG_VER_PLGN="v1.9.2" \ +ARG SHNG_VER_CORE="v1.9.3" \ + SHNG_VER_PLGN="v1.9.3" \ SHNG_REPO_CORE="https://github.com/smarthomeNG/smarthome.git" \ SHNG_REPO_PLGN="https://github.com/smarthomeNG/plugins.git" \ PLGN_DEL="gpio zwave" From 2f5d2c6f8d195c0791b2a9bc94d3c3c4d4a0475e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=B6ppner?= Date: Sun, 6 Nov 2022 16:57:57 +0100 Subject: [PATCH 22/35] Starting to update documentation --- README.md | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 37b0d0f..7f3a01a 100644 --- a/README.md +++ b/README.md @@ -5,16 +5,23 @@ This is a Dockerfile/image to build a container for SmarthomeNG. ## Quick Start -To pull from docker hub: +### Start from scratch + +- You should create a folder to store the files for configuration before starting the container. This folder can stay empty at the beginning, the container will create the structure itself. + +#### Docker native ``` -docker pull henfri/smarthome-ng +docker pull smarthomeng/smarthomeng ``` Clone [smartVISU](https://github.com/Martin-Gleiss/smartvisu) to `./volume/html/smartvisu`: ``` git clone https://github.com/Martin-Gleiss/smartvisu.git ./volume/html/smartvisu ``` +#### Synology NAS + +#### Portainer -### Running +#### Docker-compose / Portainer Stack Example with web server docker-compose.yaml: ``` @@ -56,6 +63,17 @@ services: > Don't forget to adjust the driver settings in SmartVISU. +### But I had a container up and running with the previous image (SHNG 1.5.1 - 1.9.1) + +While developing a very user-friendly structure for people who start new we haven't forgotten about those who run the Docker infrastructure for years already. Therefor you can run the container like you are used to with folders that are mounted into the container image. + + +#### Migrating to the new folder pattern + + + + + ## Configuration Parameters | Name | Description | From 2e8018de3f1aa461fbb4c091c0c6cc7c87ed6cbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=B6ppner?= Date: Mon, 24 Apr 2023 17:33:00 +0200 Subject: [PATCH 23/35] Change entrypoint to be able to deal with container relaunches and custom plugins --- entrypoint.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 0e6a304..e894a20 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -130,7 +130,7 @@ if [ "$USER_SHNG" ]; then fi #merge plugins appropriately -if [ -d $PATH_PLGN_TRGT ]; then +if [ -d $PATH_PLGN_TRGT -a ! -f $PATH_PLGN_TRGT/.was_merge_built ]; then # if Plugin folder is already there, specific plugins were mounted from outside shopt -s extglob nullglob # take all plugin-folders in the custom folder @@ -177,6 +177,7 @@ else touch $PATH_PLGN_TRGT/${PLUGINS_FROM_CUSTOM[i]}/.from_custom done fi + touch $PATH_PLGN_TRGT/.was_merge_built fi # start SmartHomeNG From 2f43f656e41e9f0ec0c1555d7d31dbcbc668e3da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=B6ppner?= Date: Mon, 24 Apr 2023 19:21:15 +0200 Subject: [PATCH 24/35] Bump to 1.9.5 / Minor adjustment of Plugin-merger --- Dockerfile | 4 ++-- entrypoint.sh | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4e87b6d..1fcbff9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,8 +12,8 @@ RUN set -eux; apt-get update; apt-get install -y --no-install-recommends \ rm -rf /var/lib/apt/lists/* # prepare clone -ARG SHNG_VER_CORE="v1.9.3" \ - SHNG_VER_PLGN="v1.9.3" \ +ARG SHNG_VER_CORE="v1.9.5" \ + SHNG_VER_PLGN="v1.9.5" \ SHNG_REPO_CORE="https://github.com/smarthomeNG/smarthome.git" \ SHNG_REPO_PLGN="https://github.com/smarthomeNG/plugins.git" \ PLGN_DEL="gpio zwave" diff --git a/entrypoint.sh b/entrypoint.sh index e894a20..0d5359d 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -153,6 +153,10 @@ if [ -d $PATH_PLGN_TRGT -a ! -f $PATH_PLGN_TRGT/.was_merge_built ]; then fi else # if plugin-folder is not yet available, build new one and merge plugins + # if we come here, and the folder is present already, we are re-building this whole exercise + if [ -d $PATH_PLGN_TRGT ]; then + rm -rf $PATH_PLGN_TRGT + fi cp -alr $PATH_PLGN_DFLT $PATH_PLGN_TRGT if [ -d $PATH_PLGN_USER ]; then if [ -f $PATH_PLGN_USER/download_plugins.sh ]; then From c907b9cbeb2c778259a51403197a6826f8c9a0b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=B6ppner?= Date: Mon, 24 Apr 2023 19:52:28 +0200 Subject: [PATCH 25/35] chown PATH_DATA itself, too --- entrypoint.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/entrypoint.sh b/entrypoint.sh index 0d5359d..7b8e7d0 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -119,6 +119,7 @@ if [ "$USER_SHNG" ]; then for i in $DIRS_DATA; do chown -R $USER_SHNG $PATH_DATA/$i done + chown $USER_SHNG $PATH_DATA fi if [ "$SKIP_CHOWN_HTML" != "1" ]; then chown -R $USER_WWW $PATH_HTML From 312e958cf00053f58acedd22258fde47ad255f54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=B6ppner?= Date: Mon, 24 Apr 2023 20:09:34 +0200 Subject: [PATCH 26/35] Adjust to make /var writable as well --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 1fcbff9..fd9bb2c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -119,6 +119,7 @@ RUN set -eux; \ chmod go+rw $PATH_CONF/etc; \ # prepare data mkdir -p $PATH_SHNG/var/run; \ + chmod go+rw $PATH_SHNG/var; \ chmod go+rw $PATH_SHNG/var/run; \ for i in $DIRS_DATA; do \ mkdir -p $PATH_DATA/$i; \ From ff88c743876680e99190b41508305293b31c720f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=B6ppner?= Date: Fri, 1 Dec 2023 14:39:13 +0100 Subject: [PATCH 27/35] Find pip-command --- Dockerfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index fd9bb2c..2fa0034 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ ### dockerfile for smarthomNG flavor "full" ### select python base image #################################################### -FROM python:3.9-slim As python-base +FROM python:3.10-slim As python-base ### Build Stage 1 - clone smarthome NG from Git ################################# FROM python-base As stage1 @@ -52,8 +52,10 @@ RUN set -eux; \ python -m pip install --no-cache-dir ruamel.yaml; \ # create links from the default plugins-folder to the to be used one. cp -alr plugins-default plugins; \ + echo "PIP:"; \ + which pip3; \ # create requirement files - python3 bin/smarthome.py --stop + python3 bin/smarthome.py --stop --pip3_command ### Build Stage 3 - build requirements for smarthomeNG ########################### FROM python-base As stage3 From c41f5fb4212199e4e3697d863e972062573ab03b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=B6ppner?= Date: Fri, 1 Dec 2023 14:40:52 +0100 Subject: [PATCH 28/35] Specified pip3 command --- Dockerfile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2fa0034..211f9a4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -52,10 +52,8 @@ RUN set -eux; \ python -m pip install --no-cache-dir ruamel.yaml; \ # create links from the default plugins-folder to the to be used one. cp -alr plugins-default plugins; \ - echo "PIP:"; \ - which pip3; \ # create requirement files - python3 bin/smarthome.py --stop --pip3_command + python3 bin/smarthome.py --stop --pip3_command /usr/local/bin/pip3 ### Build Stage 3 - build requirements for smarthomeNG ########################### FROM python-base As stage3 From a6ce46e56db17f0f6023792f964263b7fbe6ed8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=B6ppner?= Date: Fri, 1 Dec 2023 14:54:03 +0100 Subject: [PATCH 29/35] Install pyephem from debian package to avoid compile --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index 211f9a4..a923f58 100644 --- a/Dockerfile +++ b/Dockerfile @@ -44,6 +44,8 @@ ARG PLGN_CONFLICT="appletv hue2" WORKDIR /usr/local/smarthome RUN set -eux; \ + apt-get update; apt-get install -y --no-install-recommends \ + pyephem; \ # remove some plugins to remove their requirements if [ "$PLGN_CONFLICT" ]; then \ for i in $PLGN_CONFLICT; do rm -rf plugins-default/$i; done; \ From 8712606eec93a44d877df6686a44813b22a90b43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=B6ppner?= Date: Fri, 1 Dec 2023 14:59:22 +0100 Subject: [PATCH 30/35] Choose python3-ephem from apt --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index a923f58..5407aee 100644 --- a/Dockerfile +++ b/Dockerfile @@ -45,7 +45,7 @@ ARG PLGN_CONFLICT="appletv hue2" WORKDIR /usr/local/smarthome RUN set -eux; \ apt-get update; apt-get install -y --no-install-recommends \ - pyephem; \ + python3-ephem; \ # remove some plugins to remove their requirements if [ "$PLGN_CONFLICT" ]; then \ for i in $PLGN_CONFLICT; do rm -rf plugins-default/$i; done; \ @@ -66,6 +66,7 @@ COPY --from=stage2 /usr/local/smarthome/requirements/all.txt /requirements.txt RUN set -eux; \ apt-get update; apt-get install -y --no-install-recommends \ #pyjq + python3-ephem \ automake \ #pyjq, openzwave build-essential \ From 312ec430536ce0d5d70dfeaa50995051665ad7cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=B6ppner?= Date: Fri, 1 Dec 2023 15:02:02 +0100 Subject: [PATCH 31/35] Update to Python 3.11 to have only one base --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 5407aee..7c73627 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ ### dockerfile for smarthomNG flavor "full" ### select python base image #################################################### -FROM python:3.10-slim As python-base +FROM python:3.11-slim As python-base ### Build Stage 1 - clone smarthome NG from Git ################################# FROM python-base As stage1 From cfdc4b4d2efa4d5ac30cd9c18b99b598e4bd57a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=B6ppner?= Date: Mon, 4 Dec 2023 15:05:43 +0100 Subject: [PATCH 32/35] Set Root user action to ignore --- Dockerfile | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7c73627..7383334 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ ### dockerfile for smarthomNG flavor "full" ### select python base image #################################################### -FROM python:3.11-slim As python-base +FROM python:3.9-slim As python-base ### Build Stage 1 - clone smarthome NG from Git ################################# FROM python-base As stage1 @@ -44,8 +44,6 @@ ARG PLGN_CONFLICT="appletv hue2" WORKDIR /usr/local/smarthome RUN set -eux; \ - apt-get update; apt-get install -y --no-install-recommends \ - python3-ephem; \ # remove some plugins to remove their requirements if [ "$PLGN_CONFLICT" ]; then \ for i in $PLGN_CONFLICT; do rm -rf plugins-default/$i; done; \ @@ -55,7 +53,7 @@ RUN set -eux; \ # create links from the default plugins-folder to the to be used one. cp -alr plugins-default plugins; \ # create requirement files - python3 bin/smarthome.py --stop --pip3_command /usr/local/bin/pip3 + python3 bin/smarthome.py --stop --pip3_command "/usr/local/bin/pip3 --root-user-action=ignore" ### Build Stage 3 - build requirements for smarthomeNG ########################### FROM python-base As stage3 From 75fff0755d43ae3ba5a9559d0143fd285e8ecbfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=B6ppner?= Date: Mon, 4 Dec 2023 15:09:38 +0100 Subject: [PATCH 33/35] now via environment var --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 7383334..efaede8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -53,7 +53,8 @@ RUN set -eux; \ # create links from the default plugins-folder to the to be used one. cp -alr plugins-default plugins; \ # create requirement files - python3 bin/smarthome.py --stop --pip3_command "/usr/local/bin/pip3 --root-user-action=ignore" + export PIP_ROOT_USER_ACTION=ignore \ + python3 bin/smarthome.py --stop --pip3_command /usr/local/bin/pip3 ### Build Stage 3 - build requirements for smarthomeNG ########################### FROM python-base As stage3 From c1165619c7ae2bfe40d8ae3e2f9e3f9c81d16cf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=B6ppner?= Date: Mon, 4 Dec 2023 15:16:54 +0100 Subject: [PATCH 34/35] now really via env-var --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index efaede8..2e86876 100644 --- a/Dockerfile +++ b/Dockerfile @@ -53,7 +53,7 @@ RUN set -eux; \ # create links from the default plugins-folder to the to be used one. cp -alr plugins-default plugins; \ # create requirement files - export PIP_ROOT_USER_ACTION=ignore \ + export PIP_ROOT_USER_ACTION=ignore; \ python3 bin/smarthome.py --stop --pip3_command /usr/local/bin/pip3 ### Build Stage 3 - build requirements for smarthomeNG ########################### From 94c3a67b0e301dd3e341dfb95401dce51cb5f785 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=B6ppner?= Date: Mon, 4 Dec 2023 15:23:00 +0100 Subject: [PATCH 35/35] Now in the right order --- Dockerfile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2e86876..b527780 100644 --- a/Dockerfile +++ b/Dockerfile @@ -48,12 +48,13 @@ RUN set -eux; \ if [ "$PLGN_CONFLICT" ]; then \ for i in $PLGN_CONFLICT; do rm -rf plugins-default/$i; done; \ fi; \ -# necessary to run smarthome.py - python -m pip install --no-cache-dir ruamel.yaml; \ # create links from the default plugins-folder to the to be used one. cp -alr plugins-default plugins; \ -# create requirement files +# necessary to run smarthome.py export PIP_ROOT_USER_ACTION=ignore; \ + /usr/local/bin/pip3 install --upgrade pip; \ + /usr/local/bin/pip3 install --no-cache-dir ruamel.yaml; \ +# create requirement files python3 bin/smarthome.py --stop --pip3_command /usr/local/bin/pip3 ### Build Stage 3 - build requirements for smarthomeNG ###########################