Upgrade base images and build tools (#369)

Updates:

* Alpine to 3.14.3
* Debian to 11.1
* binfmt to tonistiigi/binfmt:qemu-v6.1.0 (required for building Debian 11 ARM images with buildx)

Furthermore the [pushrm](https://github.com/christian-korneck/docker-pushrm) Docker CLI plugin is now used for updating the README on Docker Hub.

Signed-off-by: Wouter Born <github@maindrain.net>
pull/371/head
Wouter Born 2021-11-13 17:26:58 +01:00 committed by GitHub
parent e779df9929
commit 5e2aebe2fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 18 deletions

View File

@ -21,9 +21,6 @@ jobs:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Set up QEMU
run: docker run --rm --privileged docker/binfmt:a7996909642ee92942dcd6cff44b9b95f08dad64
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1 uses: docker/setup-buildx-action@v1

View File

@ -81,10 +81,11 @@ Comments, suggestions and contributions are welcome!
**Distributions:** **Distributions:**
* `debian` for Debian 10 "buster" (default when not specified in tag) ([Dockerfile](https://github.com/openhab/openhab-docker/blob/main/debian/Dockerfile)) * `debian` for Debian 11 "bullseye" (default when not specified in tag) ([Dockerfile](https://github.com/openhab/openhab-docker/blob/main/debian/Dockerfile))
* `alpine` for Alpine 3.14 ([Dockerfile](https://github.com/openhab/openhab-docker/blob/main/alpine/Dockerfile)) * `alpine` for Alpine 3.14 ([Dockerfile](https://github.com/openhab/openhab-docker/blob/main/alpine/Dockerfile))
The Alpine images are substantially smaller than the Debian images but may be less compatible because OpenJDK is used (see [Prerequisites](https://www.openhab.org/docs/installation/#prerequisites) for known disadvantages). The Alpine images are substantially smaller than the Debian images but may be less compatible because OpenJDK is used (see [Prerequisites](https://www.openhab.org/docs/installation/#prerequisites) for known disadvantages).
Older container images may use older versions of the Debian and Alpine base images.
If you are unsure about what your needs are, you probably want to use `openhab/openhab:3.1.0`. If you are unsure about what your needs are, you probably want to use `openhab/openhab:3.1.0`.
@ -523,7 +524,7 @@ First enable BuildKit support, configure QEMU binary formats and a builder using
```shell ```shell
$ echo '{"experimental":true}' | sudo tee /etc/docker/daemon.json $ echo '{"experimental":true}' | sudo tee /etc/docker/daemon.json
$ export DOCKER_CLI_EXPERIMENTAL=enabled $ export DOCKER_CLI_EXPERIMENTAL=enabled
$ docker run --rm --privileged docker/binfmt:a7996909642ee92942dcd6cff44b9b95f08dad64 $ docker run --privileged --rm tonistiigi/binfmt:qemu-v6.1.0 --install all
$ sudo systemctl restart docker $ sudo systemctl restart docker
$ docker buildx create --name builder --use $ docker buildx create --name builder --use
``` ```

View File

@ -1,4 +1,4 @@
FROM alpine:3.14.2 FROM alpine:3.14.3
ARG BUILD_DATE ARG BUILD_DATE
ARG VCS_REF ARG VCS_REF

2
debian/Dockerfile vendored
View File

@ -1,4 +1,4 @@
FROM debian:10.11-slim FROM debian:11.1-slim
ARG BUILD_DATE ARG BUILD_DATE
ARG VCS_REF ARG VCS_REF

View File

@ -182,26 +182,23 @@ validate_readme_constraints() {
} }
update_dockerhub_readme() { update_dockerhub_readme() {
# Acquire token for Docker Hub API if [ "$(docker info 2>&1 | grep 'pushrm: Push Readme to container registry' | wc -l)" -eq "0" ]; then
local login_payload="{\"username\": \"${DOCKER_USERNAME}\", \"password\": \"${DOCKER_PASSWORD}\"}" # The pushrm plugin is available from https://github.com/christian-korneck/docker-pushrm
local token=$(curl -s -H "Content-Type: application/json" -X POST -d "${login_payload}" https://hub.docker.com/v2/users/login/ | sed -E 's#\{"token": "(.+)"\}#\1#g') echo "Failed to update README for $(docker_repo) on Docker Hub (pushrm Docker CLI plugin not installed)" >&2
exit 1
fi
# Send a PATCH request to update the description of the repository if docker pushrm $(docker_repo); then
echo "Updating README for $(docker_repo) on Docker Hub"
local readme_filepath="./README.md"
local repo_url="https://hub.docker.com/v2/repositories/$(docker_repo)/"
local response_code=$(curl -s --write-out %{response_code} --output /dev/null -H "Authorization: JWT ${token}" -X PATCH --data-urlencode full_description@${readme_filepath} ${repo_url})
if [ $response_code -eq 200 ]; then
echo "Successfully updated README for $(docker_repo) on Docker Hub" echo "Successfully updated README for $(docker_repo) on Docker Hub"
else else
echo "Failed to update README for $(docker_repo) on Docker Hub (Response code: $response_code)" >&2 echo "Failed to update README for $(docker_repo) on Docker Hub" >&2
exit 1 exit 1
fi fi
} }
prepare_builder() { prepare_builder() {
if [ "$BUILDER" == "" ]; then if [ "$BUILDER" == "" ]; then
docker run --privileged --rm tonistiigi/binfmt:qemu-v6.1.0 --install all &> /dev/null
(docker buildx inspect builder &> /dev/null && echo -e "\nReusing existing builder") || \ (docker buildx inspect builder &> /dev/null && echo -e "\nReusing existing builder") || \
(docker buildx create --name builder --use &> /dev/null && echo -e "\nCreated builder") (docker buildx create --name builder --use &> /dev/null && echo -e "\nCreated builder")
BUILDER="builder" BUILDER="builder"