diff --git a/.VERSION b/.VERSION index c60d416f..3a3fd047 100644 --- a/.VERSION +++ b/.VERSION @@ -1 +1 @@ -v6.2.0-beta.1 \ No newline at end of file +v7.0.0-beta.1 \ No newline at end of file diff --git a/.github/workflows/build-debian-image-beta-node18.yml b/.github/workflows/build-debian-image-beta-node18.yml new file mode 100644 index 00000000..b9e16812 --- /dev/null +++ b/.github/workflows/build-debian-image-beta-node18.yml @@ -0,0 +1,128 @@ +# Github action to build Docker image from beta branch (tag: beta) +name: Build debian beta-node18 + +on: + release: + types: [prereleased] + workflow_dispatch: + +jobs: + build-beta-node18-image: + runs-on: ubuntu-latest + steps: + - name: Getting published prerelease tag + run: echo "RELEASE_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + + - name: Checkout repo + uses: actions/checkout@v3 + with: + repository: 'buanet/ioBroker.docker' + ref: ${{ env.RELEASE_TAG }} + + - name: Get and write version and date + id: version + run: | + VERSION="$(cat .VERSION)" + MAJORVERSION="$(cat .VERSION | cut -c 1-2 | sed -r 's#^(.{0})#\1latest-#')" + DATI="$(date --rfc-3339=seconds | sed 's/ /T/')" + echo "This is the Version: $VERSION" + echo "version=$VERSION" >> $GITHUB_ENV + echo "This is the Major Version: $MAJORVERSION" + echo "majorversion=$MAJORVERSION" >> $GITHUB_ENV + echo "This is the Buildnumber/Timestamp: $DATI" + echo "dati=$DATI" >> $GITHUB_ENV + # startup script + sed -e "s/\${VERSION}/$VERSION/" -e "s/\${BUILD}/$DATI/" ./debian/scripts/iobroker_startup.sh > ./debian/scripts/iobroker_startup.tmp + mv -f ./debian/scripts/iobroker_startup.tmp ./debian/scripts/iobroker_startup.sh + # amd64 + sed -e "s/\${VERSION}/$VERSION/" -e "s/\${DATI}/$DATI/" ./debian/node18/Dockerfile > ./debian/node18/Dockerfile.tmp + mv -f ./debian/node18/Dockerfile.tmp ./debian/node18/Dockerfile + + - name: Set up manifest tool + run: | + wget https://github.com/estesp/manifest-tool/releases/download/v0.7.0/manifest-tool-linux-amd64 -O manifest-tool + chmod +x manifest-tool + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2.0.0 + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v2.0.0 + + - name: Login to DockerHub + uses: docker/login-action@v2.0.0 + with: + username: ${{ secrets.DOCKER_USER }} + password: ${{ secrets.DOCKER_PASS }} + + - name: Login to GitHub Container Registry + uses: docker/login-action@v2.0.0 + with: + registry: ghcr.io + username: ${{ secrets.PACKAGES_USER }} + password: ${{ secrets.PACKAGES_PASS }} + + - name: Build Docker image (node18-amd64) + uses: docker/build-push-action@v3.0.0 + with: + context: ./debian + file: ./debian/node18/Dockerfile + push: true + platforms: linux/amd64 + tags: | + buanet/iobroker:${{ env.version }}-node18-amd64, + ghcr.io/buanet/iobroker:${{ env.version }}-node18-amd64 + + - name: Build Docker image (node18-arm32v7) + uses: docker/build-push-action@v3.0.0 + with: + context: ./debian + file: ./debian/node18/Dockerfile + push: true + platforms: linux/arm/v7 + tags: | + buanet/iobroker:${{ env.version }}-node18-arm32v7, + ghcr.io/buanet/iobroker:${{ env.version }}-node18-arm32v7 + + - name: Build Docker image (node18-arm64v8) + uses: docker/build-push-action@v3.0.0 + with: + context: ./debian + file: ./debian/node18/Dockerfile + push: true + platforms: linux/arm64/v8 + tags: | + buanet/iobroker:${{ env.version }}-node18-arm64v8, + ghcr.io/buanet/iobroker:${{ env.version }}-node18-arm64v8 + + - name: Create and push manifests + run: | + sed -e "s/\${VERSION}/${{ env.version }}-node18/g" -e "s/\${DOCKERTAG}/beta-node18/g" ./manifest.yml > manifest_beta-node18.yaml + ./manifest-tool --username ${{ secrets.DOCKER_USER }} --password ${{ secrets.DOCKER_PASS }} push from-spec manifest_beta-node18.yaml + sed -e "s/\${VERSION}/${{ env.version }}-node18/g" -e "s/\${DOCKERTAG}/beta-node18/g" ./manifest_ghcr.yml > manifest_ghcr_beta-node18.yaml + ./manifest-tool --username ${{ secrets.PACKAGES_USER }} --password ${{ secrets.PACKAGES_PASS }} push from-spec manifest_ghcr_beta-node18.yaml + sed -e "s/\${VERSION}/${{ env.version }}-node18/g" -e "s/\${DOCKERTAG}/${{ env.version }}-node18/g" ./manifest.yml > manifest_version-node18.yaml + ./manifest-tool --username ${{ secrets.DOCKER_USER }} --password ${{ secrets.DOCKER_PASS }} push from-spec manifest_version-node18.yaml + sed -e "s/\${VERSION}/${{ env.version }}-node18/g" -e "s/\${DOCKERTAG}/${{ env.version }}-node18/g" ./manifest_ghcr.yml > manifest_ghcr_version-node18.yaml + ./manifest-tool --username ${{ secrets.PACKAGES_USER }} --password ${{ secrets.PACKAGES_PASS }} push from-spec manifest_ghcr_version-node18.yaml + + - name: Delete untagged images from GitHub packages + uses: actions/github-script@v6 + with: + github-token: ${{ secrets.PACKAGES_PASS }} + script: | + const response = await github.request("GET /users/${{ env.OWNER }}/packages/container/${{ env.PACKAGE_NAME }}/versions", + { per_page: ${{ env.PER_PAGE }} + }); + for(version of response.data) { + if (version.metadata.container.tags.length == 0) { + console.log("delete " + version.id) + const deleteResponse = await github.request("DELETE /user/packages/container/${{ env.PACKAGE_NAME }}/versions/" + version.id, { }); + console.log("status " + deleteResponse.status) + } + } + env: + OWNER: buanet + PACKAGE_NAME: iobroker + PER_PAGE: 100 diff --git a/.github/workflows/build-debian-image-beta.yml b/.github/workflows/build-debian-image-beta.yml index ae5b8ac9..a06e63aa 100644 --- a/.github/workflows/build-debian-image-beta.yml +++ b/.github/workflows/build-debian-image-beta.yml @@ -35,8 +35,8 @@ jobs: sed -e "s/\${VERSION}/$VERSION/" -e "s/\${BUILD}/$DATI/" ./debian/scripts/iobroker_startup.sh > ./debian/scripts/iobroker_startup.tmp mv -f ./debian/scripts/iobroker_startup.tmp ./debian/scripts/iobroker_startup.sh # amd64 - sed -e "s/\${VERSION}/$VERSION/" -e "s/\${DATI}/$DATI/" ./debian/node14/Dockerfile > ./debian/node14/Dockerfile.tmp - mv -f ./debian/node14/Dockerfile.tmp ./debian/node14/Dockerfile + sed -e "s/\${VERSION}/$VERSION/" -e "s/\${DATI}/$DATI/" ./debian/node16/Dockerfile > ./debian/node16/Dockerfile.tmp + mv -f ./debian/node16/Dockerfile.tmp ./debian/node16/Dockerfile - name: Set up manifest tool run: | @@ -67,7 +67,7 @@ jobs: uses: docker/build-push-action@v3.0.0 with: context: ./debian - file: ./debian/node14/Dockerfile + file: ./debian/node16/Dockerfile push: true platforms: linux/amd64 tags: | @@ -78,7 +78,7 @@ jobs: uses: docker/build-push-action@v3.0.0 with: context: ./debian - file: ./debian/node14/Dockerfile + file: ./debian/node16/Dockerfile push: true platforms: linux/arm/v7 tags: | @@ -89,7 +89,7 @@ jobs: uses: docker/build-push-action@v3.0.0 with: context: ./debian - file: ./debian/node14/Dockerfile + file: ./debian/node16/Dockerfile push: true platforms: linux/arm64/v8 tags: | diff --git a/.github/workflows/build-debian-image-dev-node18.yml b/.github/workflows/build-debian-image-dev-node18.yml new file mode 100644 index 00000000..1650967c --- /dev/null +++ b/.github/workflows/build-debian-image-dev-node18.yml @@ -0,0 +1,119 @@ +# Github action to build Docker image from dev branch (tag: dev) +name: Build debian dev-node18 + +on: + workflow_dispatch: + +jobs: + build-dev-node18-image: + runs-on: ubuntu-latest + steps: + - name: Checkout repo (dev) + uses: actions/checkout@v3 + with: + repository: 'buanet/ioBroker.docker' + ref: 'main' + + - name: Get and write version and date + id: version + run: | + VERSION="$(cat .VERSION)" + MAJORVERSION="$(cat .VERSION | cut -c 1-2 | sed -r 's#^(.{0})#\1latest-#')" + DATI="$(date --rfc-3339=seconds | sed 's/ /T/')" + echo "This is the Version: $VERSION" + echo "version=$VERSION" >> $GITHUB_ENV + echo "This is the Major Version: $MAJORVERSION" + echo "majorversion=$MAJORVERSION" >> $GITHUB_ENV + echo "This is the Buildnumber/Timestamp: $DATI" + echo "dati=$DATI" >> $GITHUB_ENV + # startup script + sed -e "s/\${VERSION}/$VERSION-dev/" -e "s/\${BUILD}/$DATI/" ./debian/scripts/iobroker_startup.sh > ./debian/scripts/iobroker_startup.tmp + mv -f ./debian/scripts/iobroker_startup.tmp ./debian/scripts/iobroker_startup.sh + # amd64 + sed -e "s/\${VERSION}/$VERSION-dev/" -e "s/\${DATI}/$DATI/" ./debian/node18/Dockerfile > ./debian/node18/Dockerfile.tmp + mv -f ./debian/node18/Dockerfile.tmp ./debian/node18/Dockerfile + + - name: Set up manifest tool + run: | + wget https://github.com/estesp/manifest-tool/releases/download/v0.7.0/manifest-tool-linux-amd64 -O manifest-tool + chmod +x manifest-tool + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2.0.0 + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v2.0.0 + + - name: Login to DockerHub + uses: docker/login-action@v2.0.0 + with: + username: ${{ secrets.DOCKER_USER }} + password: ${{ secrets.DOCKER_PASS }} + + - name: Login to GitHub Container Registry + uses: docker/login-action@v2.0.0 + with: + registry: ghcr.io + username: ${{ secrets.PACKAGES_USER }} + password: ${{ secrets.PACKAGES_PASS }} + + - name: Build Docker image (node18-amd64) + uses: docker/build-push-action@v3.0.0 + with: + context: ./debian + file: ./debian/node18/Dockerfile + push: true + platforms: linux/amd64 + tags: | + buanet/iobroker:dev-node18-amd64, + ghcr.io/buanet/iobroker:dev-node18-amd64 + + - name: Build Docker image (node18-arm32v7) + uses: docker/build-push-action@v3.0.0 + with: + context: ./debian + file: ./debian/node18/Dockerfile + push: true + platforms: linux/arm/v7 + tags: | + buanet/iobroker:dev-node18-arm32v7, + ghcr.io/buanet/iobroker:dev-node18-arm32v7 + + - name: Build Docker image (node18-arm64v8) + uses: docker/build-push-action@v3.0.0 + with: + context: ./debian + file: ./debian/node18/Dockerfile + push: true + platforms: linux/arm64/v8 + tags: | + buanet/iobroker:dev-node18-arm64v8, + ghcr.io/buanet/iobroker:dev-node18-arm64v8 + + - name: Create and push manifests + run: | + sed -e "s/\${VERSION}/dev-node18/g" -e "s/\${DOCKERTAG}/dev-node18/g" ./manifest.yml > manifest_dev-node18.yaml + ./manifest-tool --username ${{ secrets.DOCKER_USER }} --password ${{ secrets.DOCKER_PASS }} push from-spec manifest_dev-node18.yaml + sed -e "s/\${VERSION}/dev-node18/g" -e "s/\${DOCKERTAG}/dev-node18/g" ./manifest_ghcr.yml > manifest_ghcr_dev-node18.yaml + ./manifest-tool --username ${{ secrets.PACKAGES_USER }} --password ${{ secrets.PACKAGES_PASS }} push from-spec manifest_ghcr_dev-node18.yaml + + - name: Delete untagged images from GitHub packages + uses: actions/github-script@v6 + with: + github-token: ${{ secrets.PACKAGES_PASS }} + script: | + const response = await github.request("GET /users/${{ env.OWNER }}/packages/container/${{ env.PACKAGE_NAME }}/versions", + { per_page: ${{ env.PER_PAGE }} + }); + for(version of response.data) { + if (version.metadata.container.tags.length == 0) { + console.log("delete " + version.id) + const deleteResponse = await github.request("DELETE /user/packages/container/${{ env.PACKAGE_NAME }}/versions/" + version.id, { }); + console.log("status " + deleteResponse.status) + } + } + env: + OWNER: buanet + PACKAGE_NAME: iobroker + PER_PAGE: 100 diff --git a/.github/workflows/build-debian-image-dev.yml b/.github/workflows/build-debian-image-dev.yml index b530064e..31d46baf 100644 --- a/.github/workflows/build-debian-image-dev.yml +++ b/.github/workflows/build-debian-image-dev.yml @@ -30,8 +30,8 @@ jobs: sed -e "s/\${VERSION}/$VERSION-dev/" -e "s/\${BUILD}/$DATI/" ./debian/scripts/iobroker_startup.sh > ./debian/scripts/iobroker_startup.tmp mv -f ./debian/scripts/iobroker_startup.tmp ./debian/scripts/iobroker_startup.sh # amd64 - sed -e "s/\${VERSION}/$VERSION-dev/" -e "s/\${DATI}/$DATI/" ./debian/node14/Dockerfile > ./debian/node14/Dockerfile.tmp - mv -f ./debian/node14/Dockerfile.tmp ./debian/node14/Dockerfile + sed -e "s/\${VERSION}/$VERSION-dev/" -e "s/\${DATI}/$DATI/" ./debian/node16/Dockerfile > ./debian/node16/Dockerfile.tmp + mv -f ./debian/node16/Dockerfile.tmp ./debian/node16/Dockerfile - name: Set up manifest tool run: | @@ -62,7 +62,7 @@ jobs: uses: docker/build-push-action@v3.0.0 with: context: ./debian - file: ./debian/node14/Dockerfile + file: ./debian/node16/Dockerfile push: true platforms: linux/amd64 tags: | @@ -73,7 +73,7 @@ jobs: uses: docker/build-push-action@v3.0.0 with: context: ./debian - file: ./debian/node14/Dockerfile + file: ./debian/node16/Dockerfile push: true platforms: linux/arm/v7 tags: | @@ -84,7 +84,7 @@ jobs: uses: docker/build-push-action@v3.0.0 with: context: ./debian - file: ./debian/node14/Dockerfile + file: ./debian/node16/Dockerfile push: true platforms: linux/arm64/v8 tags: | diff --git a/CHANGELOG.md b/CHANGELOG.md index 6bb9f542..b77d2732 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## Changelog -### v6.2.0-beta.1 (coming soon) +### v7.0.0-beta.1 (16.06.2022) +* upgrade node version to recommended node16 * rewrite maintenance script ([#243 by @agross](https://github.com/buanet/ioBroker.docker/pull/243)) * enhance container shutdown on SIGTERM ([as requested with #264 by @buzz0r](https://github.com/buanet/ioBroker.docker/pull/264)) * enhance startup script logging diff --git a/debian/node18/Dockerfile b/debian/node18/Dockerfile new file mode 100644 index 00000000..ef9001e3 --- /dev/null +++ b/debian/node18/Dockerfile @@ -0,0 +1,97 @@ +FROM debian:bullseye-slim + +LABEL org.opencontainers.image.title="Official ioBroker Docker Image" \ + org.opencontainers.image.description="Officical Docker image for ioBroker smarthome software (https://www.iobroker.net)" \ + org.opencontainers.image.documentation="https://github.com/buanet/ioBroker.docker#readme" \ + org.opencontainers.image.authors="André Germann " \ + org.opencontainers.image.url="https://github.com/buanet/ioBroker.docker" \ + org.opencontainers.image.source="https://github.com/buanet/ioBroker.docker" \ + org.opencontainers.image.base.name="docker.io/library/debian:bullseye-slim" \ + org.opencontainers.image.version="${VERSION}" \ + org.opencontainers.image.created="${DATI}" + +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 \ + # Install node + && curl -sL https://deb.nodesource.com/setup_18.x | bash \ + && apt-get update && apt-get install -y nodejs \ + # 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 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 +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 \ + && echo $(hostname) > /opt/.firstrun \ + # Deleting UUID from build + && iobroker unsetup -y \ + # Backup initial ioBroker and userscript folder + && tar -cf /opt/initial_iobroker.tar /opt/iobroker \ + && tar -cf /opt/initial_userscripts.tar /opt/userscripts \ + # 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 \ + # 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" \ + LANG="de_DE.UTF-8" \ + LANGUAGE="de_DE:de" \ + LC_ALL="de_DE.UTF-8" \ + SETGID=1000 \ + SETUID=1000 \ + TZ="Europe/Berlin" + +# Expose default admin ui port +EXPOSE 8081 + +# Change work dir +WORKDIR /opt/iobroker/ + +# Healthcheck +HEALTHCHECK --interval=15s --timeout=5s --retries=5 \ + CMD ["/bin/bash", "-c", "/opt/scripts/healthcheck.sh"] + +# Run startup-script +ENTRYPOINT ["/bin/bash", "-c", "/opt/scripts/iobroker_startup.sh"]