Ankündigung

Einklappen
Keine Ankündigung bisher.

Dockerimage für 1.11

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

    Dockerimage für 1.11

    Hallo, Ich hatte mir ja mal das Dockerfile geforkt und versuche es laufen zu bekommen. Nach dem Update auf 1.11 habe ich es jetzt nochmal angepasst und nutze es auch seit gestern erfolgreich. Wäre mal über Eure Meinung / Erfahrungen gespannt. Gerade bei den rechten klemmt es noch.

    Dafür habe ich aber eine Action ergänzt, die das File mal baut, startet und versucht zu prüfen, ob es einen Fehler gibt. Ganz net für Fail Early.

    Bin auf alle Kommentare gespannt:
    https://github.com/AAPohl/docker_smarthomeNG

    #2
    Hey,
    Klasse! (Auch wenn dein Beitrag schon ein paar Tage her ist.)

    Ich habe auch versucht, von 1.9.0 (Henfri) auf das aktuelle 1.11 umzusteigen. Hat nicht funktioniert.
    Wenn ich dein Dockerfile testen könnte / darf, sag Bescheid. Danke.

    Allerdings habe ich eine Umgebung, die hier wohl so keiner einsetzt: Unraid mit SmarthomeNG, knxd und nginx > smartVISU als separate Docker.

    Gruß!

    Kommentar


      #3
      Ich verstehe deinen Beitrag nicht.
      1) Hat nicht funktioniert, ist keine nützliche fehlermeldung oder problembeschreibung.

      2)
      aldaris hat sein docker file doch verlinkt, also kannst du es sofort testen

      3) Was genau ist an deiner Umgebung? So ungewöhnlich?

      Kommentar


        #4
        64er Gerne testen, freue ich, wenn ich noch was verbessern kann. Nginx und knxd laufen bei mir auch in eigenen Containern. Ging nach kleiner Anpassung in knxd.

        Kommentar


          #5
          Hallo Leute,
          Danke für eure Antworten. Und leider habe ich nur sporadisch Zeit, mich um dieses zu kümmern. Sorry dafür.
          Aber ich habe mich jetzt noch einmal intensiv damit beschäftigt und besser dokumentiert.
          Mein System:
          Unraid 7.1.4
          Docker: henfri/knxd v0.14.42 - host
          Docker: henfri/smarthome-ng v1.9.0 - bridge
          Docker: nginx latest - bridge
          MDT IP Interface


          henfri
          Du hast Recht, ein nützliche Fehlermeldung war das nicht. Aber ich hatte mit Unmengen an Fehler zu kämpfen.
          Die offizielle Variante aus GIT vom SmartHomeNG Team kann ich heute noch nicht übersetzen - der Build schlägt feht. Hiermit habe ich aufgegeben.
          Einige Besonderheiten muss es unter Unraid doch geben, sonst hätte der Build funktioniert.

          aldaris
          Danke für dein Angebot zu helfen. Aber ich es habe mit ein paar Änderungen an deinem Dockerfile geschafft, ein Image zu erzeugen und einen Container zu erstellen.
          Code:
          Fehler Log
          ###
          - /usr/local/smarthome/requirements/all.txt == test.txt
          ###
          root@nas:/mnt/user/appdata/aapshng# docker build -t shng:aap -f dockerfile .
          [+] Building 641.9s (17/17) FINISHED
          ###
          docker run -d -p 83:8383 --name SHNG8 shng:aap
          Fehler: exec /entrypoint.sh: no such file or directory
          ---
          COPY geändert zu:
          COPY ./entrypoint.sh ./shng_wrapper.sh /
          #COPY * /
          und angefügt:
          RUN chmod +x /entrypoint.sh
          RUN chmod +x /shng_wrapper.sh​
          ---
          in den Shellscripten Zeilenenden prüfen: \r\n >> \n
          entrypoint.sh
          shng_wrapper.sh
          docker run -d -p 83:8383 --name SHNG8 shng:aap
          Fehler: exec /entrypoint.sh: permission denied
          ---
          in den Shellscripten Zeile 1 ändern zu: #!/bin/bash
          ---
          Neubau OK:
          docker build --no-cache -t shng:aap -f dockerfile .
          Start OK:
          docker run -d -p 83:8383 --name SHNG shng:aap​
          Erweitert habe ich PLGN_DEL um all die Plugins, die ich nicht benötige. Die müssen ja nicht im Image landen.
          Dafür liebe ich es, mich im Image mit dem mc zu bewegen - den habe ich hinzugefügt.
          Hier das finale Dockerfile:
          Code:
          # Quelle: AAPohl https://github.com/AAPohl/docker_smarthomeNG/blob/master/Dockerfile
          ### dockerfile for smarthomNG flavor "full"
          
          ### select python base image ####################################################
          FROM python:3.10-slim AS python-base
          
          ### Build Stage 1 - clone smarthome NG from Git #################################
          FROM python-base AS stage1
          
          # install git
          RUN set -eux; apt-get update; apt-get install -y --no-install-recommends \
              ca-certificates git gcc python3-dev; \
            rm -rf /var/lib/apt/lists/*
          
          # prepare clone
          ARG SHNG_VER_CORE="v1.11.0" \
              SHNG_VER_PLGN="v1.11.0" \
              PLGN_DEL="gpio alexa alexa4p3 alexarc4shng apcups appletv artnet asterisk avdevice beolink bose_soundtouch bsblan buderus byd_bat casambi comfoair darksky deebot_ozmo denon dmx drexelundweiss ebus enigma2 epson eta_pu garminconnect harmony helios helios_tcp husky husky2 indego indego4shng intercom_2n join jvcproj kathrein kostal kostalmodbus ksemmodbus leveljet lirc lms luxtronic2 mieleathome mikrotik mlgw mpd mvg_live neato nuki nut operationlog oppo philips_tv pioneer pluggit prowl pushbullet pushover raumfeld raumfeld_ng rcs1000n rcswitch resol robonect roomba roomba_980 roombapysh rpi_info rpi1wire russound slack sma sma_em sma_mb sonos speech squeezebox systemair telegram thz trovis557x unifi waterkotte wettercom withings_health wunderground xiaomi_vac yamaha yamahayxc 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 .; \
            git -c advice.detachedHead=false clone --single-branch --branch $SHNG_VER_PLGN \
              https://github.com/smarthomeNG/plugins.git plugins; \
          # remove git files - not usefull inside a container
            find . -name ".git*" -print -exec rm -rf {} +; \
            find . -name ".*" -type f -print -exec rm -rf {} +; \
          # remove unneccessary files - no need for doc, dev and so on inside a container
            rm -rf deprecated tests dev tools/* doc tox.ini setup.py; \
            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; \
            fi
          
          ### Build Stage 1 - determine requirements for smarthomNG #######################
          FROM stage1 AS stage2
          
          ARG PLGN_CONFLICT="appletv hue2"
          
          WORKDIR /usr/local/smarthome
          RUN set -eux; \
          # remove some plugins to remove there requirements
            if [ "$PLGN_CONFLICT" ]; then \
              for i in $PLGN_CONFLICT; do rm -rf plugins/$i; done; \
            fi; \
          # necessary to run smarthome.py
            python -m pip install --no-cache-dir "ruamel.yaml<=0.16.8"; \
          # create requirement files
            python3 bin/smarthome.py --stop
          
          ### Build Stage 3 - build requirements for smarthomNG ###########################
          FROM python-base AS stage3
          
          COPY --from=stage2 /usr/local/smarthome/requirements/all.txt /requirements.txt
          
          # install/update/build requirements
          RUN set -eux; \
            apt-get update; apt-get install -y --no-install-recommends \
              automake \
              build-essential \
              libglib2.0-dev \
              librrd-dev \
              libtool \
              libudev-dev; \
            rm -rf /var/lib/apt/lists/*; \
            # install python requirements
            python -m pip install --no-cache-dir -r requirements.txt
          
          ### Final Stage ##################################################################
          FROM python-base
          
          # copy files into place
          COPY --from=stage1 /usr/local/smarthome /usr/local/smarthome
          COPY --from=stage3 /usr/local/lib /usr/local/lib
          
          RUN set -eux; \
          # add user smarthome:smarthome respectively 1000:1000
            adduser --disabled-password --gecos "" smarthome; \
          # install needed tools
            apt-get update; apt-get install -y --no-install-recommends \
              gosu \
              #openzwave \
              libcom-err2 \
              mc \
              procps \
              unzip; \
            rm -rf /var/lib/apt/lists/*; \
            #python -m pip install --no-cache-dir --upgrade pip; \
          # prepare volumes
            PATH_SHNG="/usr/local/smarthome"; \
            PATH_CONF="/mnt/conf"; \
            PATH_DATA="/mnt/data"; \
            PATH_HTML="/mnt/html"; \
            DIRS_CONF="etc items logics scenes functions structs"; \
            DIRS_DATA="backup restore cache db log"; \
            chmod go+rws $PATH_SHNG/requirements; \
          # prepare conf
            mkdir -p $PATH_CONF; \
            for i in $DIRS_CONF; do \
              if [ ! -d $PATH_SHNG/$i ]; then \
                mkdir -p $PATH_SHNG/$i; \
                chmod go+rw $PATH_SHNG/$i; \  
              fi; \
              cp -vlr $PATH_SHNG/$i $PATH_CONF; \
              touch $PATH_CONF/$i/.not_mounted; \
            done; \
            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; \
              ln -vs $PATH_DATA/$i $PATH_SHNG/var/$i; \
              touch $PATH_DATA/$i/.not_mounted; \
            done; \
            chmod go+rw $PATH_DATA/log; \
            # fix for wrong log path
            ln -vs $PATH_DATA/log $PATH_SHNG/log; \
          # prepare smartvisu
            mkdir -p $PATH_HTML /var/www; \
            ln -vsf $PATH_HTML /var/www/html;
            
          # expose ports for cli, websocket, admin interface
          EXPOSE 2323 2424 8383
          
          # and finalize
          COPY ./entrypoint.sh ./shng_wrapper.sh /
          RUN chmod +x /entrypoint.sh
          RUN chmod +x /shng_wrapper.sh
          ENTRYPOINT ["/entrypoint.sh"]
          CMD ["--foreground"]​

          Kommentar

          Lädt...
          X