diff --git a/.VERSION b/.VERSION index 7c01dfe..b13f2ca 100644 --- a/.VERSION +++ b/.VERSION @@ -1 +1 @@ -v5.2.0-beta4 \ No newline at end of file +v5.3.0-beta1 \ No newline at end of file diff --git a/.github/workflows/build-debian-image-beta-node14.yml b/.github/workflows/build-debian-image-beta-node14.yml index f0b1e8b..08e80e2 100644 --- a/.github/workflows/build-debian-image-beta-node14.yml +++ b/.github/workflows/build-debian-image-beta-node14.yml @@ -50,7 +50,7 @@ jobs: - name: Set up Docker Buildx id: buildx - uses: docker/setup-buildx-action@v1.5.1 + uses: docker/setup-buildx-action@v1.6.0 - name: Login to DockerHub uses: docker/login-action@v1.10.0 @@ -66,7 +66,7 @@ jobs: password: ${{ secrets.PACKAGES_PASS }} - name: Build Docker image (node14-amd64) - uses: docker/build-push-action@v2.6.1 + uses: docker/build-push-action@v2.7.0 with: context: ./debian file: ./debian/node14/Dockerfile @@ -77,7 +77,7 @@ jobs: ghcr.io/buanet/iobroker:${{ env.version }}-node14-amd64 - name: Build Docker image (node14-arm32v7) - uses: docker/build-push-action@v2.6.1 + uses: docker/build-push-action@v2.7.0 with: context: ./debian file: ./debian/node14/Dockerfile @@ -88,7 +88,7 @@ jobs: ghcr.io/buanet/iobroker:${{ env.version }}-node14-arm32v7 - name: Build Docker image (node14-arm64v8) - uses: docker/build-push-action@v2.6.1 + uses: docker/build-push-action@v2.7.0 with: context: ./debian file: ./debian/node14/Dockerfile @@ -110,7 +110,7 @@ jobs: ./manifest-tool --username ${{ secrets.PACKAGES_USER }} --password ${{ secrets.PACKAGES_PASS }} push from-spec manifest_ghcr_version-node14.yaml - name: Delete untagged images from GitHub packages - uses: actions/github-script@v3 + uses: actions/github-script@v5 with: github-token: ${{ secrets.PACKAGES_PASS }} script: | diff --git a/.github/workflows/build-debian-image-beta.yml b/.github/workflows/build-debian-image-beta.yml index b4c583c..1a20b48 100644 --- a/.github/workflows/build-debian-image-beta.yml +++ b/.github/workflows/build-debian-image-beta.yml @@ -50,7 +50,7 @@ jobs: - name: Set up Docker Buildx id: buildx - uses: docker/setup-buildx-action@v1.5.1 + uses: docker/setup-buildx-action@v1.6.0 - name: Login to DockerHub uses: docker/login-action@v1.10.0 @@ -66,7 +66,7 @@ jobs: password: ${{ secrets.PACKAGES_PASS }} - name: Build Docker image (amd64) - uses: docker/build-push-action@v2.6.1 + uses: docker/build-push-action@v2.7.0 with: context: ./debian file: ./debian/node12/Dockerfile @@ -77,7 +77,7 @@ jobs: ghcr.io/buanet/iobroker:${{ env.version }}-amd64 - name: Build Docker image (arm32v7) - uses: docker/build-push-action@v2.6.1 + uses: docker/build-push-action@v2.7.0 with: context: ./debian file: ./debian/node12/Dockerfile @@ -88,7 +88,7 @@ jobs: ghcr.io/buanet/iobroker:${{ env.version }}-arm32v7 - name: Build Docker image (arm64v8) - uses: docker/build-push-action@v2.6.1 + uses: docker/build-push-action@v2.7.0 with: context: ./debian file: ./debian/node12/Dockerfile @@ -110,7 +110,7 @@ jobs: ./manifest-tool --username ${{ secrets.PACKAGES_USER }} --password ${{ secrets.PACKAGES_PASS }} push from-spec manifest_ghcr_version.yaml - name: Delete untagged images from GitHub packages - uses: actions/github-script@v3 + uses: actions/github-script@v5 with: github-token: ${{ secrets.PACKAGES_PASS }} script: | diff --git a/.github/workflows/build-debian-image-dev-node14.yml b/.github/workflows/build-debian-image-dev-node14.yml index 0d6c0ac..cb3c58a 100644 --- a/.github/workflows/build-debian-image-dev-node14.yml +++ b/.github/workflows/build-debian-image-dev-node14.yml @@ -46,7 +46,7 @@ jobs: - name: Set up Docker Buildx id: buildx - uses: docker/setup-buildx-action@v1.5.1 + uses: docker/setup-buildx-action@v1.6.0 - name: Login to DockerHub uses: docker/login-action@v1.10.0 @@ -62,7 +62,7 @@ jobs: password: ${{ secrets.PACKAGES_PASS }} - name: Build Docker image (node14-amd64) - uses: docker/build-push-action@v2.6.1 + uses: docker/build-push-action@v2.7.0 with: context: ./debian file: ./debian/node14/Dockerfile @@ -73,7 +73,7 @@ jobs: ghcr.io/buanet/iobroker:dev-node14-amd64 - name: Build Docker image (node14-arm32v7) - uses: docker/build-push-action@v2.6.1 + uses: docker/build-push-action@v2.7.0 with: context: ./debian file: ./debian/node14/Dockerfile @@ -84,7 +84,7 @@ jobs: ghcr.io/buanet/iobroker:dev-node14-arm32v7 - name: Build Docker image (node14-arm64v8) - uses: docker/build-push-action@v2.6.1 + uses: docker/build-push-action@v2.7.0 with: context: ./debian file: ./debian/node14/Dockerfile @@ -102,7 +102,7 @@ jobs: ./manifest-tool --username ${{ secrets.PACKAGES_USER }} --password ${{ secrets.PACKAGES_PASS }} push from-spec manifest_ghcr_dev-node14.yaml - name: Delete untagged images from GitHub packages - uses: actions/github-script@v3 + uses: actions/github-script@v5 with: github-token: ${{ secrets.PACKAGES_PASS }} script: | diff --git a/.github/workflows/build-debian-image-dev.yml b/.github/workflows/build-debian-image-dev.yml index 929bbaa..2f6411c 100644 --- a/.github/workflows/build-debian-image-dev.yml +++ b/.github/workflows/build-debian-image-dev.yml @@ -46,7 +46,7 @@ jobs: - name: Set up Docker Buildx id: buildx - uses: docker/setup-buildx-action@v1.5.1 + uses: docker/setup-buildx-action@v1.6.0 - name: Login to DockerHub uses: docker/login-action@v1.10.0 @@ -62,7 +62,7 @@ jobs: password: ${{ secrets.PACKAGES_PASS }} - name: Build Docker image (amd64) - uses: docker/build-push-action@v2.6.1 + uses: docker/build-push-action@v2.7.0 with: context: ./debian file: ./debian/node12/Dockerfile @@ -73,7 +73,7 @@ jobs: ghcr.io/buanet/iobroker:dev-amd64 - name: Build Docker image (arm32v7) - uses: docker/build-push-action@v2.6.1 + uses: docker/build-push-action@v2.7.0 with: context: ./debian file: ./debian/node12/Dockerfile @@ -84,7 +84,7 @@ jobs: ghcr.io/buanet/iobroker:dev-arm32v7 - name: Build Docker image (arm64v8) - uses: docker/build-push-action@v2.6.1 + uses: docker/build-push-action@v2.7.0 with: context: ./debian file: ./debian/node12/Dockerfile @@ -102,7 +102,7 @@ jobs: ./manifest-tool --username ${{ secrets.PACKAGES_USER }} --password ${{ secrets.PACKAGES_PASS }} push from-spec manifest_ghcr_dev.yaml - name: Delete untagged images from GitHub packages - uses: actions/github-script@v3 + uses: actions/github-script@v5 with: github-token: ${{ secrets.PACKAGES_PASS }} script: | diff --git a/.github/workflows/build-debian-image-main.yml b/.github/workflows/build-debian-image-main.yml index 783059a..0290755 100644 --- a/.github/workflows/build-debian-image-main.yml +++ b/.github/workflows/build-debian-image-main.yml @@ -48,7 +48,7 @@ jobs: - name: Set up Docker Buildx id: buildx - uses: docker/setup-buildx-action@v1.5.1 + uses: docker/setup-buildx-action@v1.6.0 - name: Login to DockerHub (buanet) uses: docker/login-action@v1.10.0 @@ -64,7 +64,7 @@ jobs: password: ${{ secrets.PACKAGES_PASS }} - name: Build Docker image (amd64) - uses: docker/build-push-action@v2.6.1 + uses: docker/build-push-action@v2.7.0 with: context: ./debian file: ./debian/node12/Dockerfile @@ -75,7 +75,7 @@ jobs: ghcr.io/buanet/iobroker:${{ env.version }}-amd64 - name: Build Docker image (arm32v7) - uses: docker/build-push-action@v2.6.1 + uses: docker/build-push-action@v2.7.0 with: context: ./debian file: ./debian/node12/Dockerfile @@ -86,7 +86,7 @@ jobs: ghcr.io/buanet/iobroker:${{ env.version }}-arm32v7 - name: Build Docker image (arm64v8) - uses: docker/build-push-action@v2.6.1 + uses: docker/build-push-action@v2.7.0 with: context: ./debian file: ./debian/node12/Dockerfile @@ -112,7 +112,7 @@ jobs: ./manifest-tool --username ${{ secrets.PACKAGES_USER }} --password ${{ secrets.PACKAGES_PASS }} push from-spec manifest_ghcr_version.yaml - name: Delete untagged images from GitHub packages - uses: actions/github-script@v3 + uses: actions/github-script@v5 with: github-token: ${{ secrets.PACKAGES_PASS }} script: | diff --git a/.github/workflows/build-debian-image-main_iob.yml b/.github/workflows/build-debian-image-main_iob.yml index ed4edba..1b35470 100644 --- a/.github/workflows/build-debian-image-main_iob.yml +++ b/.github/workflows/build-debian-image-main_iob.yml @@ -48,7 +48,7 @@ jobs: - name: Set up Docker Buildx id: buildx - uses: docker/setup-buildx-action@v1.5.1 + uses: docker/setup-buildx-action@v1.6.0 - name: Login to DockerHub (iobroker) uses: docker/login-action@v1.10.0 @@ -57,7 +57,7 @@ jobs: password: ${{ secrets.DOCKER_PASS_IOB }} - name: Build Docker image (amd64) - uses: docker/build-push-action@v2.6.1 + uses: docker/build-push-action@v2.7.0 with: context: ./debian file: ./debian/node12/Dockerfile @@ -67,7 +67,7 @@ jobs: iobroker/iobroker:${{ env.version }}-amd64, - name: Build Docker image (arm32v7) - uses: docker/build-push-action@v2.6.1 + uses: docker/build-push-action@v2.7.0 with: context: ./debian file: ./debian/node12/Dockerfile @@ -77,7 +77,7 @@ jobs: iobroker/iobroker:${{ env.version }}-arm32v7, - name: Build Docker image (arm64v8) - uses: docker/build-push-action@v2.6.1 + uses: docker/build-push-action@v2.7.0 with: context: ./debian file: ./debian/node12/Dockerfile diff --git a/CHANGELOG.md b/CHANGELOG.md index 0112ef6..dbe0b8f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,17 @@ ## Changelog -### v5.2.0-beta4 (2021-09-10) -* adding iobroker user rights for "gosu" -* adding more labels in OCI standard format -* fixing workdir bug -* adding backitup compatibility +### v5.3.0-beta1 (2021-10-07) +* adding check for PACKAGES on startup (#201) +* adding packages for discovery +* adding packages for backitup +* reorganizing Dockerfile + +### v5.2.0 (2021-09-30) +* v5.2.0-beta4 (2021-09-10) + * adding iobroker user rights for "gosu" + * adding more labels in OCI standard format + * fixing workdir bug + * adding backitup compatibility * v5.2.0-beta3 (2021-09-04) * reducing layers in dockerfile * making hostname check mandatory for startup diff --git a/debian/node12/Dockerfile b/debian/node12/Dockerfile index ddceb6e..fe2edfd 100644 --- a/debian/node12/Dockerfile +++ b/debian/node12/Dockerfile @@ -14,39 +14,42 @@ ENV DEBIAN_FRONTEND noninteractive # Install prerequisites (including node) and generating locales RUN apt-get update && apt-get install -y \ + apt-utils \ + cifs-utils \ curl \ gosu \ + iputils-ping \ jq \ locales \ + nfs-common \ procps \ + python3 \ + python3-dev \ sudo \ + tar \ + tzdata \ udev \ wget \ - # Generating locales - && sed -i 's/^# *\(de_DE.UTF-8\)/\1/' /etc/locale.gen \ - && sed -i 's/^# *\(en_US.UTF-8\)/\1/' /etc/locale.gen \ - && locale-gen \ # Install node && curl -sL https://deb.nodesource.com/setup_12.x | bash \ && apt-get update && apt-get install -y nodejs \ - && rm -rf /var/lib/apt/lists/* + # Install node-gyp + && npm install -g node-gyp \ + # Generating locales + && sed -i 's/^# *\(de_DE.UTF-8\)/\1/' /etc/locale.gen \ + && sed -i 's/^# *\(en_US.UTF-8\)/\1/' /etc/locale.gen \ + && locale-gen -# Create scripts directorys and copy scripts -RUN mkdir -p /opt/scripts/ \ - && mkdir -p /opt/userscripts/ \ - && chmod 777 /opt/scripts/ \ - && chmod 777 /opt/userscripts/ -WORKDIR /opt/scripts/ -COPY scripts/* ./ -RUN chmod +x *.sh -WORKDIR /opt/userscripts/ -COPY userscripts/* ./ -RUN chmod +x *.sh +# Create directorys and copy scripts +COPY scripts /opt/scripts +COPY userscripts /opt/userscripts +RUN chmod 777 /opt/scripts/ \ + && chmod 777 /opt/userscripts/ \ + && chmod +x /opt/scripts/*.sh \ + && chmod +x /opt/userscripts/*.sh # Install ioBroker -WORKDIR / -RUN apt-get update \ - && curl -sL https://iobroker.net/install.sh | bash - \ +RUN curl -sL https://iobroker.net/install.sh | bash - \ && mkdir -p /opt/scripts/.docker_config/ \ && echo "starting" > /opt/scripts/.docker_config/.healthcheck \ && echo "${VERSION}" > /opt/scripts/.docker_config/.thisisdocker \ @@ -56,15 +59,20 @@ RUN apt-get update \ # Backup initial ioBroker and userscript folder && tar -cf /opt/initial_iobroker.tar /opt/iobroker \ && tar -cf /opt/initial_userscripts.tar /opt/userscripts \ - && rm -rf /var/lib/apt/lists/* - -# Setting up iobroker-user (shell, home dir and rights) -RUN chsh -s /bin/bash iobroker \ + # Setting up iobroker-user (shell, home dir and rights) + && chsh -s /bin/bash iobroker \ && usermod --home /opt/iobroker iobroker \ && usermod -u 1000 iobroker \ && groupmod -g 1000 iobroker \ && chown root:iobroker /usr/sbin/gosu \ - && chmod +s /usr/sbin/gosu + && chmod +s /usr/sbin/gosu \ + # Clean up installation cache + && apt-get autoclean -y \ + && apt-get autoremove \ + && apt-get clean \ + && rm -rf /tmp/* /var/tmp/* \ + && rm -rf /root/.cache/* /root/.npm/* \ + && rm -rf /var/lib/apt/lists/* # Setting up default ENVs ENV DEBIAN_FRONTEND="teletype" \ diff --git a/debian/node14/Dockerfile b/debian/node14/Dockerfile index f565b39..694bfb0 100644 --- a/debian/node14/Dockerfile +++ b/debian/node14/Dockerfile @@ -14,39 +14,42 @@ ENV DEBIAN_FRONTEND noninteractive # Install prerequisites (including node) and generating locales RUN apt-get update && apt-get install -y \ + apt-utils \ + cifs-utils \ curl \ gosu \ + iputils-ping \ jq \ locales \ + nfs-common \ procps \ + python3 \ + python3-dev \ sudo \ + tar \ + tzdata \ udev \ wget \ - # Generating locales - && sed -i 's/^# *\(de_DE.UTF-8\)/\1/' /etc/locale.gen \ - && sed -i 's/^# *\(en_US.UTF-8\)/\1/' /etc/locale.gen \ - && locale-gen \ # Install node && curl -sL https://deb.nodesource.com/setup_14.x | bash \ && apt-get update && apt-get install -y nodejs \ - && rm -rf /var/lib/apt/lists/* + # Install node-gyp + && npm install -g node-gyp \ + # Generating locales + && sed -i 's/^# *\(de_DE.UTF-8\)/\1/' /etc/locale.gen \ + && sed -i 's/^# *\(en_US.UTF-8\)/\1/' /etc/locale.gen \ + && locale-gen -# Create scripts directorys and copy scripts -RUN mkdir -p /opt/scripts/ \ - && mkdir -p /opt/userscripts/ \ - && chmod 777 /opt/scripts/ \ - && chmod 777 /opt/userscripts/ -WORKDIR /opt/scripts/ -COPY scripts/* ./ -RUN chmod +x *.sh -WORKDIR /opt/userscripts/ -COPY userscripts/* ./ -RUN chmod +x *.sh +# Create directorys and copy scripts +COPY scripts /opt/scripts +COPY userscripts /opt/userscripts +RUN chmod 777 /opt/scripts/ \ + && chmod 777 /opt/userscripts/ \ + && chmod +x /opt/scripts/*.sh \ + && chmod +x /opt/userscripts/*.sh # Install ioBroker -WORKDIR / -RUN apt-get update \ - && curl -sL https://iobroker.net/install.sh | bash - \ +RUN curl -sL https://iobroker.net/install.sh | bash - \ && mkdir -p /opt/scripts/.docker_config/ \ && echo "starting" > /opt/scripts/.docker_config/.healthcheck \ && echo "${VERSION}" > /opt/scripts/.docker_config/.thisisdocker \ @@ -56,15 +59,20 @@ RUN apt-get update \ # Backup initial ioBroker and userscript folder && tar -cf /opt/initial_iobroker.tar /opt/iobroker \ && tar -cf /opt/initial_userscripts.tar /opt/userscripts \ - && rm -rf /var/lib/apt/lists/* - -# Setting up iobroker-user (shell, home dir and rights) -RUN chsh -s /bin/bash iobroker \ + # Setting up iobroker-user (shell, home dir and rights) + && chsh -s /bin/bash iobroker \ && usermod --home /opt/iobroker iobroker \ && usermod -u 1000 iobroker \ && groupmod -g 1000 iobroker \ && chown root:iobroker /usr/sbin/gosu \ - && chmod +s /usr/sbin/gosu + && chmod +s /usr/sbin/gosu \ + # Clean up installation cache + && apt-get autoclean -y \ + && apt-get autoremove \ + && apt-get clean \ + && rm -rf /tmp/* /var/tmp/* \ + && rm -rf /root/.cache/* /root/.npm/* \ + && rm -rf /var/lib/apt/lists/* # Setting up default ENVs ENV DEBIAN_FRONTEND="teletype" \ diff --git a/debian/scripts/iobroker_startup.sh b/debian/scripts/iobroker_startup.sh index 643eeb8..5a7fb41 100644 --- a/debian/scripts/iobroker_startup.sh +++ b/debian/scripts/iobroker_startup.sh @@ -92,8 +92,8 @@ then if [ "$packages" != "" ] then echo "Installing additional packages is set by ENV." - echo "The following packages will be installed:" $packages"..." - echo $packages > /opt/scripts/.packages + echo "Checking the following Packages:" $packages"..." + echo $packages > /opt/scripts/.docker_config/.packages bash /opt/scripts/setup_packages.sh -install echo "Done." echo ' ' diff --git a/debian/scripts/setup_packages.sh b/debian/scripts/setup_packages.sh index d959a5b..e547cc9 100644 --- a/debian/scripts/setup_packages.sh +++ b/debian/scripts/setup_packages.sh @@ -3,9 +3,16 @@ if [ $1 == "-install" ] then apt-get -qq update - packages=$(cat /opt/scripts/.packages) + packages=$(cat /opt/scripts/.docker_config/.packages) for i in $packages; do - sudo apt-get -qq -y install $i + if [ $(dpkg-query -W -f='${Status}' $i 2>/dev/null | grep -c "ok installed") -eq 0 ]; + then + echo "$i is not installed. Installing..." + sudo apt-get -qq -y install $i + echo "Done." + else + echo "$i is already installed." + fi done elif [ $1 == "-update" ] then @@ -16,7 +23,13 @@ else exit 1 fi +# Cleanup +apt-get autoclean -y +apt-get autoremove +apt-get clean +rm -rf /tmp/* /var/tmp/* +rm -rf /root/.cache/* rm -rf /var/lib/apt/lists/* -rm -f /opt/scripts/.packages +rm -f /opt/scripts/.docker_config/.packages exit 0