Merge branch 'beta' into dependabot/github_actions/main/docker/build-push-action-4.1.1

This commit is contained in:
André Germann
2023-07-02 21:56:14 +02:00
committed by GitHub
13 changed files with 223 additions and 54 deletions

View File

@@ -1 +1 @@
v8.0.1 v8.1.0-beta.2

View File

@@ -1 +1 @@
2.6.19 2.6.23

View File

@@ -39,11 +39,11 @@ jobs:
mv -f ./debian/node20/Dockerfile.tmp ./debian/node20/Dockerfile mv -f ./debian/node20/Dockerfile.tmp ./debian/node20/Dockerfile
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v2.1.0 uses: docker/setup-qemu-action@v2.2.0
- name: Set up Docker Buildx - name: Set up Docker Buildx
id: buildx id: buildx
uses: docker/setup-buildx-action@v2.5.0 uses: docker/setup-buildx-action@v2.8.0
- name: Login to DockerHub - name: Login to DockerHub
uses: docker/login-action@v2.1.0 uses: docker/login-action@v2.1.0
@@ -64,12 +64,17 @@ jobs:
context: ./debian context: ./debian
file: ./debian/node20/Dockerfile file: ./debian/node20/Dockerfile
push: true push: true
platforms: linux/amd64,linux/arm/v7,linux/arm64/v8 platforms: |
linux/amd64
linux/arm/v7
linux/arm64/v8
tags: | tags: |
buanet/iobroker:beta-node20, buanet/iobroker:beta-node20,
buanet/iobroker:${{ env.version }}-node20, buanet/iobroker:${{ env.version }}-node20,
ghcr.io/buanet/iobroker:beta-node20, ghcr.io/buanet/iobroker:beta-node20,
ghcr.io/buanet/iobroker:${{ env.version }}-node20 ghcr.io/buanet/iobroker:${{ env.version }}-node20
provenance: false
outputs: type=image,name=target,annotation-index.org.opencontainers.image.description=Official Docker image for ioBroker smarthome software (https://www.iobroker.net)
- name: Delete untagged images from GitHub packages - name: Delete untagged images from GitHub packages
uses: actions/github-script@v6 uses: actions/github-script@v6

View File

@@ -39,11 +39,11 @@ jobs:
mv -f ./debian/node18/Dockerfile.tmp ./debian/node18/Dockerfile mv -f ./debian/node18/Dockerfile.tmp ./debian/node18/Dockerfile
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v2.1.0 uses: docker/setup-qemu-action@v2.2.0
- name: Set up Docker Buildx - name: Set up Docker Buildx
id: buildx id: buildx
uses: docker/setup-buildx-action@v2.5.0 uses: docker/setup-buildx-action@v2.8.0
- name: Login to DockerHub - name: Login to DockerHub
uses: docker/login-action@v2.1.0 uses: docker/login-action@v2.1.0

View File

@@ -9,11 +9,11 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v3 uses: actions/checkout@v3.5.0
with: with:
repository: 'buanet/ioBroker.docker' repository: 'buanet/ioBroker.docker'
- name: Fetching version tag and date - name: Fetch version tag and date
id: version id: version
run: | run: |
VERSION="$(cat .VERSION)" VERSION="$(cat .VERSION)"
@@ -33,11 +33,11 @@ jobs:
mv -f ./debian/node20/Dockerfile.tmp ./debian/node20/Dockerfile mv -f ./debian/node20/Dockerfile.tmp ./debian/node20/Dockerfile
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v2.1.0 uses: docker/setup-qemu-action@v2.2.0
- name: Set up Docker Buildx - name: Set up Docker Buildx
id: buildx id: buildx
uses: docker/setup-buildx-action@v2.5.0 uses: docker/setup-buildx-action@v2.8.0
- name: Login to DockerHub - name: Login to DockerHub
uses: docker/login-action@v2.1.0 uses: docker/login-action@v2.1.0
@@ -58,13 +58,18 @@ jobs:
context: ./debian context: ./debian
file: ./debian/node20/Dockerfile file: ./debian/node20/Dockerfile
push: true push: true
platforms: linux/amd64,linux/arm/v7,linux/arm64/v8 platforms: |
linux/amd64
linux/arm/v7
linux/arm64/v8
tags: | tags: |
buanet/iobroker:dev-node20, buanet/iobroker:dev-node20,
ghcr.io/buanet/iobroker:dev-node20 ghcr.io/buanet/iobroker:dev-node20
provenance: false
outputs: type=image,name=target,annotation-index.org.opencontainers.image.description=Official Docker image for ioBroker smarthome software (https://www.iobroker.net)
- name: Delete untagged images from GitHub packages - name: Delete untagged images from GitHub Container Registry
uses: actions/github-script@v6 uses: actions/github-script@v6.4.1
with: with:
github-token: ${{ secrets.PACKAGES_PASS }} github-token: ${{ secrets.PACKAGES_PASS }}
script: | script: |

View File

@@ -33,11 +33,11 @@ jobs:
mv -f ./debian/node18/Dockerfile.tmp ./debian/node18/Dockerfile mv -f ./debian/node18/Dockerfile.tmp ./debian/node18/Dockerfile
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v2.1.0 uses: docker/setup-qemu-action@v2.2.0
- name: Set up Docker Buildx - name: Set up Docker Buildx
id: buildx id: buildx
uses: docker/setup-buildx-action@v2.5.0 uses: docker/setup-buildx-action@v2.8.0
- name: Login to DockerHub - name: Login to DockerHub
uses: docker/login-action@v2.1.0 uses: docker/login-action@v2.1.0

View File

@@ -42,11 +42,11 @@ jobs:
mv -f ./debian/node18/Dockerfile.tmp ./debian/node18/Dockerfile mv -f ./debian/node18/Dockerfile.tmp ./debian/node18/Dockerfile
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v2.1.0 uses: docker/setup-qemu-action@v2.2.0
- name: Set up Docker Buildx - name: Set up Docker Buildx
id: buildx id: buildx
uses: docker/setup-buildx-action@v2.5.0 uses: docker/setup-buildx-action@v2.8.0
- name: Login to DockerHub (iobroker) - name: Login to DockerHub (iobroker)
uses: docker/login-action@v2.1.0 uses: docker/login-action@v2.1.0

View File

@@ -42,11 +42,11 @@ jobs:
mv -f ./debian/node18/Dockerfile.tmp ./debian/node18/Dockerfile mv -f ./debian/node18/Dockerfile.tmp ./debian/node18/Dockerfile
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v2.1.0 uses: docker/setup-qemu-action@v2.2.0
- name: Set up Docker Buildx - name: Set up Docker Buildx
id: buildx id: buildx
uses: docker/setup-buildx-action@v2.5.0 uses: docker/setup-buildx-action@v2.8.0
- name: Login to DockerHub (buanet) - name: Login to DockerHub (buanet)
uses: docker/login-action@v2.1.0 uses: docker/login-action@v2.1.0
with: with:

View File

@@ -1,5 +1,15 @@
## Changelog ## Changelog
### v8.1.0-beta.2 (coming soon)
* prohibit restore when startup script is still running
* extend time before restart after restore is done
* influx data repo will be added automatically when PACKAGES contains influxdb or influxdb2-cli package
* v8.1.0-beta.1 (14.04.2023)
* enhance github actions
* enhance log output of maintenance script on restore ([#333](https://github.com/buanet/ioBroker.docker/issues/333))
* allow iobroker admin to be disabled at startup ([#332](https://github.com/buanet/ioBroker.docker/issues/332))
* allow deletion of objects and states db password with value "none" ([#306](https://github.com/buanet/ioBroker.docker/issues/306))
### v8.0.1 (17.04.2023) ### v8.0.1 (17.04.2023)
* fix calling of "iob setup first" on slaves ([#335](https://github.com/buanet/ioBroker.docker/issues/335)) * fix calling of "iob setup first" on slaves ([#335](https://github.com/buanet/ioBroker.docker/issues/335))

102
debian/node20/Dockerfile vendored Normal file
View File

@@ -0,0 +1,102 @@
FROM debian:bullseye-slim
LABEL org.opencontainers.image.title="Official ioBroker Docker Image" \
org.opencontainers.image.description="Official 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 <info@buanet.de>" \
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
# Copy scripts
COPY scripts /opt/scripts
COPY userscripts /opt/userscripts
# 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_20.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 \
# Change permissions for scripts
&& chmod 777 /opt/scripts/ \
&& chmod 777 /opt/userscripts/ \
&& chmod +x /opt/scripts/*.sh \
&& chmod +x /opt/userscripts/*.sh \
# Prepare
&& mkdir -p /opt/scripts/.docker_config/ \
&& echo "starting" > /opt/scripts/.docker_config/.healthcheck \
&& echo "${VERSION}" > /opt/scripts/.docker_config/.thisisdocker \
&& echo "true" > /opt/.first_run \
# Run installer
&& curl -sL https://iobroker.net/install.sh | bash - \
# Deleting UUID from build
&& iobroker unsetup -y \
&& echo "true" > /opt/iobroker/.fresh_install \
# 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"]
# Volumes for persistent data
VOLUME ["/opt/iobroker"]
# Run startup-script
ENTRYPOINT ["/bin/bash", "-c", "/opt/scripts/iobroker_startup.sh"]

View File

@@ -143,9 +143,10 @@ if [[ -f /opt/.first_run ]]; then
echo "PACKAGES is set, but OFFLINE_MODE is \"true\". Skipping Linux package installation." echo "PACKAGES is set, but OFFLINE_MODE is \"true\". Skipping Linux package installation."
elif [[ "$packages" != "" ]]; then elif [[ "$packages" != "" ]]; then
echo "PACKAGES is set. Installing the following additional Linux packages: ""$packages" echo "PACKAGES is set. Installing the following additional Linux packages: ""$packages"
echo "$packages" > /opt/scripts/.docker_config/.packages # echo "$packages" > /opt/scripts/.docker_config/.packages
bash /opt/scripts/setup_packages.sh -install bash /opt/scripts/setup_packages.sh -install
fi fi
echo ' '
# Register maintenance script # Register maintenance script
echo -n 'Registering maintenance script as command... ' echo -n 'Registering maintenance script as command... '
echo "alias maintenance=\'/opt/scripts/maintenance.sh\'" >> /root/.bashrc echo "alias maintenance=\'/opt/scripts/maintenance.sh\'" >> /root/.bashrc

View File

@@ -38,6 +38,11 @@ maintenance_enabled() {
[[ -f "$healthcheck" && "$(cat "$healthcheck")" == maintenance ]] [[ -f "$healthcheck" && "$(cat "$healthcheck")" == maintenance ]]
} }
# check status starting
check_starting() {
[[ -f "$healthcheck" && "$(cat "$healthcheck")" == starting ]]
}
# display maintenance status # display maintenance status
maintenance_status() { maintenance_status() {
if maintenance_enabled; then if maintenance_enabled; then
@@ -221,6 +226,8 @@ restart_container() {
# restore iobroker # restore iobroker
restore_iobroker() { restore_iobroker() {
echo 'You are now going to perform a restore of your iobroker.' echo 'You are now going to perform a restore of your iobroker.'
echo 'During the restore process, the container will automatically switch into maintenance mode and stop ioBroker.'
echo 'Depending on the restart policy, your container will be stopped or restarted automatically after the restore.'
if [[ "$autoconfirm" != yes ]]; then if [[ "$autoconfirm" != yes ]]; then
local reply local reply
@@ -235,11 +242,17 @@ restore_iobroker() {
echo 'This command was already confirmed by the -y or --yes option.' echo 'This command was already confirmed by the -y or --yes option.'
fi fi
echo -n 'Stopping ioBroker...' if check_starting > /dev/null; then
stop_iob echo "Startup script is still running."
echo "Please check container log and wait until ioBroker is sucessfully started."
echo "Then try again."
return 1
fi
# fixing permission errors during restore if ! maintenance_enabled > /dev/null; then
#chown -R $setuid:$setgid /opt/iobroker/backup autoconfirm=yes
enable_maintenance
fi
echo -n "Restoring ioBroker... " echo -n "Restoring ioBroker... "
set +e set +e
@@ -263,8 +276,8 @@ restore_iobroker() {
echo "!!!! You can view installation process by taking a look at ioBroker log. !!!!" echo "!!!! You can view installation process by taking a look at ioBroker log. !!!!"
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
sleep 10 sleep 10
echo 'Container will be stopped or restarted in 5 seconds...' echo 'Container will be stopped or restarted in 10 seconds...'
sleep 5 sleep 10
echo 'stopping' > "$healthcheck" echo 'stopping' > "$healthcheck"
pkill -u root pkill -u root
} }

View File

@@ -1,36 +1,69 @@
#!/bin/bash #!/bin/bash
# bash strict mode
set -euo pipefail
# Reading ENV
set +u
packages=$PACKAGES
debug=$DEBUG
set -u
export DEBIAN_FRONTEND=noninteractive export DEBIAN_FRONTEND=noninteractive
if [ "$1" == "-install" ] check_package_preq() {
then # check for influx packages
apt-get -q update >> /opt/scripts/setup_packages.log 2>&1 if [[ "$i" == "influxdb" || "$i" == "influxdb2-cli" ]]; then
packages=$(cat /opt/scripts/.docker_config/.packages) # add influxdata repo keys
echo ' ' wget -qO- https://repos.influxdata.com/influxdata-archive_compat.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/influxdata-archive_compat.gpg > /dev/null
for i in $packages; do echo 'deb [signed-by=/etc/apt/trusted.gpg.d/influxdata-archive_compat.gpg] https://repos.influxdata.com/debian stable main' | sudo tee /etc/apt/sources.list.d/influxdata.list
if [ "$(dpkg-query -W -f='${Status}' "$i" 2>/dev/null | grep -c "ok installed")" -eq 0 ]; apt-get -q update >> /opt/scripts/setup_packages.log 2>&1
then fi
echo -n "$i is not installed. Installing... " }
DEBIAN_FRONTEND=noninteractive apt-get -q -y install "$i" >> /opt/scripts/setup_packages.log 2>&1 check_package_validity() {
return=$? # check string for double spaces
if [[ "$return" -ne 0 ]]; then while echo "$packages" | grep -q ' '; do
echo "Failed." packages=$(echo "$packages" | sed 's/ / /g')
echo "For more details see \"/opt/scripts/setup_packages.log\"."
echo ' '
else
echo "Done."
fi
else
echo "$i is already installed."
fi
done done
elif [ "$1" == "-update" ]; then # remove packages when "influxdb" AND "influxdb2-cli"
if echo "$packages" | grep -qw "influxdb" && echo "$packages" | grep -qw "influxdb2-cli"; then
echo "PACKAGES includes influxdb AND influxdb2-cli."
echo "As installing both packages together is not possible, they will be skipped."
packages=$(echo "$packages" | sed 's/influxdb2-cli//g;s/influxdb//g')
# check string for double spaces again
while echo "$packages" | grep -q ' '; do
packages=$(echo "$packages" | sed 's/ / /g')
done
if [[ $debug == "true" ]]; then echo "[DEBUG] New list of packages: ""$packages"; fi
echo ' '
fi
}
if [[ "$1" == "-install" ]]; then
echo ' '
apt-get -q update >> /opt/scripts/setup_packages.log 2>&1
check_package_validity
for i in $packages; do
if ! dpkg -s "$i" >/dev/null 2>&1; then
echo -n "$i is not installed. Installing... "
check_package_preq >> /opt/scripts/setup_packages.log 2>&1
if ! apt-get -q -y install "$i" >> /opt/scripts/setup_packages.log 2>&1; then
echo "Failed."
echo "For more details see \"/opt/scripts/setup_packages.log\"."
else
echo "Done."
fi
else
echo "$i is already installed."
fi
done
elif [[ "$1" == "-update" ]]; then
echo -n "Updating Linux packages on first run... " echo -n "Updating Linux packages on first run... "
apt-get -q update >> /opt/scripts/setup_packages.log 2>&1 apt-get -q update >> /opt/scripts/setup_packages.log 2>&1
return=$?
apt-get -q -y upgrade >> /opt/scripts/setup_packages.log 2>&1
return1=$? return1=$?
if [[ "$return" -ne 0 || "$return1" -ne 0 ]]; then apt-get -q -y upgrade >> /opt/scripts/setup_packages.log 2>&1
return2=$?
if [[ "$return1" -ne 0 || "$return2" -ne 0 ]]; then
echo "Failed." echo "Failed."
echo "For more details see \"/opt/scripts/setup_packages.log\"." echo "For more details see \"/opt/scripts/setup_packages.log\"."
echo "Make sure the container has internet access to get the latest package updates." echo "Make sure the container has internet access to get the latest package updates."