Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade binfmt and update build instructions #432

Merged
merged 1 commit into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -515,26 +515,23 @@ For more information on this see the [Docker documentation](https://docs.docker.
Checkout the GitHub repository, change to a directory containing a Dockerfile (e.g. `/debian`) and then run these commands to build and run a Docker image for your current platform:

```shell
$ docker build --build-arg JAVA_VERSION=11 --build-arg OPENHAB_VERSION=4.0.3 --tag openhab/openhab .
$ docker build --build-arg JAVA_VERSION=17 --build-arg OPENHAB_VERSION=4.0.3 --tag openhab/openhab .
$ docker run openhab/openhab
```

To be able to build the same image for other platforms (e.g. arm/v7, arm64 on amd64) Docker CE 19.03 with BuildKit support can be used.
To be able to build the same image for other platforms (e.g. arm/v7, arm64 on amd64) Docker CE with BuildKit support can be used.

First enable BuildKit support, configure QEMU binary formats and a builder using:
First configure QEMU binary formats and a builder using:

```shell
$ echo '{"experimental":true}' | sudo tee /etc/docker/daemon.json
$ export DOCKER_CLI_EXPERIMENTAL=enabled
$ docker run --privileged --rm tonistiigi/binfmt:qemu-v6.1.0 --install all
$ sudo systemctl restart docker
$ docker run --privileged --rm tonistiigi/binfmt:qemu-v8.0.4 --install all
$ docker buildx create --name builder --use
```

Change to a directory containing a Dockerfile (e.g. `/debian`) and then use the following command to build an ARMv7 image:

```
$ docker buildx build --build-arg JAVA_VERSION=11 --build-arg OPENHAB_VERSION=4.0.3 --platform linux/arm/v7 --tag openhab/openhab --load .
```shell
$ docker buildx build --build-arg JAVA_VERSION=17 --build-arg OPENHAB_VERSION=4.0.3 --platform linux/arm/v7 --tag openhab/openhab --load .
```

The `build` script in the root of the repository helps to simplify building the openHAB images with BuildKit.
Expand Down
2 changes: 1 addition & 1 deletion helper-functions
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ update_dockerhub_readme() {

prepare_builder() {
if [ "$BUILDER" == "" ]; then
docker run --privileged --rm tonistiigi/binfmt:qemu-v7.0.0 --install all &> /dev/null
docker run --privileged --rm tonistiigi/binfmt:qemu-v8.0.4 --install all &> /dev/null
(docker buildx inspect builder &> /dev/null && echo -e "\nReusing existing builder") || \
(docker buildx create --name builder --use &> /dev/null && echo -e "\nCreated builder")
BUILDER="builder"
Expand Down