From 6cbabdef91c99c8d9b3665336d542d9f3b4a8cf1 Mon Sep 17 00:00:00 2001 From: Robert von Burg Date: Mon, 22 Jan 2024 16:09:25 +0100 Subject: [PATCH 1/5] [Project] Lots of changes - Don't build with buildx - Upgrade to Ubuntu 22.04 - add additional packages - remove 1.4 support --- README.md | 38 ++--------------- build.sh | 21 +++++----- pi4j-builder-1.4/.dockerignore | 13 ------ pi4j-builder-1.4/Dockerfile | 49 ---------------------- pi4j-builder-1.4/build.sh | 76 ---------------------------------- pi4j-builder-1.4/clean.sh | 67 ------------------------------ pi4j-builder-2.0/Dockerfile | 2 +- pi4j-builder-2.0/build.sh | 41 +++--------------- pi4j-builder-base/Dockerfile | 10 ++--- pi4j-builder-base/build.sh | 46 ++++---------------- pi4j-builder-native/build.sh | 44 +++----------------- pi4j-builder-native/clean.sh | 1 - pi4j-builder-repo/Dockerfile | 2 +- pi4j-builder-repo/build.sh | 43 +++---------------- 14 files changed, 45 insertions(+), 408 deletions(-) delete mode 100644 pi4j-builder-1.4/.dockerignore delete mode 100644 pi4j-builder-1.4/Dockerfile delete mode 100755 pi4j-builder-1.4/build.sh delete mode 100755 pi4j-builder-1.4/clean.sh diff --git a/README.md b/README.md index 1b1bdb9..ba15d54 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,8 @@ docker images used for compiling/building the Pi4J projects. The Pi4J builder i include the following: - **[Pi4J Base Builder](https://hub.docker.com/repository/docker/pi4j/pi4j-builder-base)** `pi4j/pi4j-builder-base:latest` : - This is the base image used by all the other builder images. It's based on Ubuntu 18.04 - with JDK 11 and Maven pre-installed. This image's entry point is a Bash shell. + This is the base image used by all the other builder images. It's based on Ubuntu 22.04 + with JDK 21 and Maven pre-installed. This image's entry point is a Bash shell. (https://hub.docker.com/repository/docker/pi4j/pi4j-builder-base) - **[Pi4J Native Builder](https://hub.docker.com/repository/docker/pi4j/pi4j-builder-native)** `pi4j/pi4j-builder-native:latest` : @@ -18,15 +18,7 @@ include the following: and build tools for architectures: `arm`, `armhf`, `aarch64/arm64`. This image's entry point is a bash shell attempting to execute the file `./build.sh` in the volume mounted under the `/build` path. - - - **[Pi4J v1.4 Builder](https://hub.docker.com/repository/docker/pi4j/pi4j-builder:1.4)** `pi4j/pi4j-builder:1.4` : - This image is derived from `pi4j/pi4j-builder-native` and additionally includes pre-cached Maven - build plugins and dependencies for [Pi4J v1.4](http://github.com/Pi4J/pi4j) builds. This image's - entry point is a Maven shell. If not explicitly provided, the default maven build arguments will be: - `clean install -DskipTests -Pnative,cross-compile`. This will effectively build all Pi4J projects including - the `pi4j-native` project containing native libraries which will be cross-compiled for RaspberryPi/ARM - (32-bit & 64-bit) devices. - + - **[Pi4J v2.0 Builder](https://hub.docker.com/repository/docker/pi4j/pi4j-builder:2.0)** `pi4j/pi4j-builder:2.0` : This image is derived from `pi4j/pi4j-builder-native` and additionally includes pre-cached Maven build plugins and dependencies for [Pi4J v2.0](http://github.com/Pi4J/pi4j-v2) builds. This image's @@ -34,7 +26,7 @@ include the following: `clean install -DskipTests -Pnative,cross-compile`. This will effectively build all Pi4J projects including the native library projects which will be cross-compiled for RaspberryPi/ARM (32-bit & 64-bit) devices. -**Note:** Pi4J versions prior to v1.4 are not currently tested or supported in these Docker images. +**Note:** Pi4J versions prior to v2.0 are not supported in these Docker images. --- ### Prerequisites: @@ -64,25 +56,6 @@ include the following: --- ### How to Build the Pi4J Project using these Docker Images: -#### Build Pi4J v1.4 - -Navigate to the parent "pi4j" directory and execute the following Docker commands: -``` -docker pull pi4j/pi4j-builder:1.4 -docker run \\ - --user "$(id -u):$(id -g)" \ - --rm \ - --volume $(pwd):/build \ - pi4j/pi4j-builder:1.4 -``` -| Docker Command Argument | Description | -| ------------- | ------------- | -| `run` | launch the Pi4J Builder container | -| `--user` | Run the build container with your user id/group id. (_this is not needed for Window or MacOS_) | -| `--rm` | Remove the temporary build container upon completion | -| `--volume` | Mount the current directory to the Docker container's `/build` path. This is where the container will attempt to locate and execute the `./build.sh` script. | -| `pi4j/pi4j-builder:1.4` | The Pi4J build container image name and version. | - #### Build Pi4J v2.0 Navigate to the parent "pi4j" directory and execute the following Docker commands: @@ -118,9 +91,6 @@ The Pi4J Docker Builder images are built using the following shell scripts: | `./pi4j-builder-native/build.sh` | builds the Pi4J Native Builder image locally for: `x86_64/amd64` & `aarch64/arm64` architectures. | | `./pi4j-builder-native/build.sh --push` | builds the Pi4J Native Builder image and pushes to DockerHub for: `x86_64/amd64` & `aarch64/arm64` architectures. | | `./pi4j-builder-native/clean.sh` | cleans the build environment and removes images from the local system for the Pi4J Native Builder image. | -| `./pi4j-builder-1.4/build.sh` | builds the Pi4J Builder image for Pi4J v1.4 locally for: `x86_64/amd64` & `aarch64/arm64` architectures. | -| `./pi4j-builder-1.4/build.sh --push` | builds the Pi4J Builder image for Pi4J v1.4 and pushes to DockerHub for: `x86_64/amd64` & `aarch64/arm64` architectures. -| `./pi4j-builder-1.4/clean.sh` | cleans the build environment and removes images from the local system for the Pi4J Builder image for Pi4J v1.4. | | `./pi4j-builder-2.0/build.sh` | builds the Pi4J Builder image for Pi4J v2.0 locally for: `x86_64/amd64` & `aarch64/arm64` architectures. | | `./pi4j-builder-2.0/build.sh --push` | builds the Pi4J Builder image for Pi4J v2.0 and pushes to DockerHub for: `x86_64/amd64` & `aarch64/arm64` architectures. | | `./pi4j-builder-2.0/clean.sh` | cleans the build environment and removes images from the local system for the Pi4J Builder image for Pi4J v2.0. | diff --git a/build.sh b/build.sh index 8fc9261..be58308 100755 --- a/build.sh +++ b/build.sh @@ -60,6 +60,11 @@ echo "* *" echo "**********************************************************************" echo +#docker buildx rm --force pi4j-builder || true +#docker buildx create --use --bootstrap \ +# --driver=docker-container \ +# --name pi4j-builder + # ********************************************************************** # BUILDING Pi4J BASE BUILDER (DOCKER IMAGE) # ********************************************************************** @@ -72,23 +77,19 @@ cd $BASE_DIR/pi4j-builder-base cd $BASE_DIR/pi4j-builder-native ./build.sh $@ -# ********************************************************************** -# BUILDING Pi4J v1.4 BUILDER (DOCKER IMAGE) -# ********************************************************************** -cd $BASE_DIR/pi4j-builder-1.4 -./build.sh $@ - # ********************************************************************** # BUILDING Pi4J v2.0 BUILDER (DOCKER IMAGE) # ********************************************************************** -cd $BASE_DIR/pi4j-builder-2.0 -./build.sh $@ +#cd $BASE_DIR/pi4j-builder-2.0 +#./build.sh $@ # ********************************************************************** # BUILDING Pi4J REPO BUILDER (DOCKER IMAGE) # ********************************************************************** -cd $BASE_DIR/pi4j-builder-repo -./build.sh $@ +#cd $BASE_DIR/pi4j-builder-repo +#./build.sh $@ + +#docker buildx rm --force pi4j-builder echo echo "**********************************************************************" diff --git a/pi4j-builder-1.4/.dockerignore b/pi4j-builder-1.4/.dockerignore deleted file mode 100644 index 78fbd9c..0000000 --- a/pi4j-builder-1.4/.dockerignore +++ /dev/null @@ -1,13 +0,0 @@ -.git -.ipynb_checkpoints/* -.DS_Store -.gitignore -README.md -test -build.sh -deploy.sh -pom.xml - -# To prevent storing dev/temporary container data -*.csv -tmp diff --git a/pi4j-builder-1.4/Dockerfile b/pi4j-builder-1.4/Dockerfile deleted file mode 100644 index f507f9e..0000000 --- a/pi4j-builder-1.4/Dockerfile +++ /dev/null @@ -1,49 +0,0 @@ -# --------------------------------------------------------------------------------- -# NATIVE BUILDER IMAGE FOR Pi4J (cross-compilers for ARMHF & AARCH64) -# --------------------------------------------------------------------------------- -FROM pi4j/pi4j-builder-native:1.4 -ARG TARGETARCH -ARG BUILDDATE -ARG BUILDVERSION -MAINTAINER Robert Savage "robert@pi4j.com" - -# docker container image labels -LABEL org.label-schema.schema-version="1.0" -LABEL org.label-schema.build-date=$BUILDDATE -LABEL org.label-schema.name="pi4j/pi4j-builder" -LABEL org.label-schema.description="Pi4J Builder Docker Image (for Pi4J v$BUILDVERSION)" -LABEL org.label-schema.url="https://pi4j.com/" -LABEL org.label-schema.vcs-url="https://github.com/pi4j/pi4j-docker" -LABEL org.label-schema.vendor="Pi4J" -LABEL org.label-schema.version=$BUILDVERSION -LABEL org.label-schema.docker.cmd="docker run --user \"$(id -u):$(id -g)\" --rm --volume $(pwd):/build pi4j/pi4j-builder:$BUILDVERSION" - -RUN echo "=========================================================" -RUN echo " BUILDING DOCKER Pi4J v$BUILDVERSION BUILDER IMAGE FOR: $TARGETARCH" -RUN echo "=========================================================" - -# --------------------------------------------------------------------------------- -# PROJECT BUILDER IMAGE FOR Pi4J v1.4 -# --------------------------------------------------------------------------------- -# we want to locally cache all build dependencies to speed up build-time, -# so we will clone the Pi4J project from GitHub and perform a download -# of all Maven build plugins and dependencies. When complete we will -# simply delete the project sources from the image and leave the M2 -# repository cache as part of the container image -RUN git clone --single-branch --branch release/1.4 https://github.com/Pi4J/pi4j /pi4j -RUN cd /pi4j && \ - mvn dependency:resolve dependency:resolve-plugins -DexcludeGroupIds="com.pi4j" -Pnative && \ - rm -R /pi4j - -# ensure read/write access permissions to the M2 repository cache for all users -RUN chmod -R a+rw /m2 - -# configure environment variables -ENV PI4J_BUILDER_DATE="$BUILDDATE" -ENV PI4J_BUILDER="$BUILDVERSION" - -# always launch Maven to perform the build -ENTRYPOINT ["/usr/bin/mvn"] - -# use these default parameters for the Maven build; can be overridden by caller -CMD ["clean", "install", "-DskipTests", "-Pnative,cross-compile"] diff --git a/pi4j-builder-1.4/build.sh b/pi4j-builder-1.4/build.sh deleted file mode 100755 index 1604ce6..0000000 --- a/pi4j-builder-1.4/build.sh +++ /dev/null @@ -1,76 +0,0 @@ -#!/bin/bash -e -### -# #%L -# ********************************************************************** -# ORGANIZATION : Pi4J -# PROJECT : Pi4J :: Build Docker Image for Pi4J v1.4 Builder -# FILENAME : build.sh -# -# This file is part of the Pi4J project. More information about -# this project can be found here: https://pi4j.com/ -# ********************************************************************** -# %% -# Copyright (C) 2012 - 2020 Pi4J -# %% -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# #L% -### - -#----------------------------------------------------------------------------------------- -# !! THIS DOCKER BUILD REQUIRES THE EXPERIMENTAL DOCKER BUILDX PLUGIN !! -#----------------------------------------------------------------------------------------- -# -# REF: https://docs.docker.com/buildx/working-with-buildx/ -# -# Docker Buildx is a CLI plugin that extends the docker command with the -# full support of the features provided by Moby BuildKit builder toolkit. -# It provides the same user experience as docker build with many new -# features like creating scoped builder instances and building against -# multiple nodes concurrently. -# -# This is an experimental feature. -# -# Experimental features provide early access to future product functionality. -# These features are intended for testing and feedback only as they may change -# between releases without warning or can be removed entirely from a future -# release. Experimental features must not be used in production environments. -# Docker does not offer support for experimental features. -# -#----------------------------------------------------------------------------------------- - -# docker image version -VERSION=1.4 - -echo -echo "**********************************************************************" -echo "* BUILDING Pi4J v$VERSION BUILDER (DOCKER IMAGE) *" -echo "**********************************************************************" -echo - -# use buildx to create a new builder instance; if needed -docker buildx create --driver-opt env.BUILDKIT_STEP_LOG_MAX_SIZE=10485760 \ - --driver-opt env.BUILDKIT_STEP_LOG_MAX_SPEED=100000000 \ - --use --name pi4j-builder-$VERSION || true; - -# perform multi-arch platform image builds; push the resulting image to the Pi4J DockerHub repository -# (https://hub.docker.com/r/pi4j/pi4j-builder) -docker buildx build \ - --build-arg BUILDDATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')" \ - --build-arg BUILDVERSION="$VERSION" \ - --platform linux/amd64,linux/arm64 \ - --tag pi4j/pi4j-builder:$VERSION . $@ - -# remove the builder instance when completed -#docker buildx rm pi4j-builder-$VERSION \ No newline at end of file diff --git a/pi4j-builder-1.4/clean.sh b/pi4j-builder-1.4/clean.sh deleted file mode 100755 index 35fd6b7..0000000 --- a/pi4j-builder-1.4/clean.sh +++ /dev/null @@ -1,67 +0,0 @@ -#!/bin/bash -e -### -# #%L -# ********************************************************************** -# ORGANIZATION : Pi4J -# PROJECT : Pi4J :: Clean Docker Image for Pi4J Builder (1.4) -# FILENAME : clean.sh -# -# This file is part of the Pi4J project. More information about -# this project can be found here: https://pi4j.com/ -# ********************************************************************** -# %% -# Copyright (C) 2012 - 2020 Pi4J -# %% -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# #L% -### - - -#----------------------------------------------------------------------------------------- -# !! THIS DOCKER BUILD REQUIRES THE EXPERIMENTAL DOCKER BUILDX PLUGIN !! -#----------------------------------------------------------------------------------------- -# -# REF: https://docs.docker.com/buildx/working-with-buildx/ -# -# Docker Buildx is a CLI plugin that extends the docker command with the -# full support of the features provided by Moby BuildKit builder toolkit. -# It provides the same user experience as docker build with many new -# features like creating scoped builder instances and building against -# multiple nodes concurrently. -# -# This is an experimental feature. -# -# Experimental features provide early access to future product functionality. -# These features are intended for testing and feedback only as they may change -# between releases without warning or can be removed entirely from a future -# release. Experimental features must not be used in production environments. -# Docker does not offer support for experimental features. -# -#----------------------------------------------------------------------------------------- - -# docker image version -VERSION=1.4 - -echo -echo "**********************************************************************" -echo "* CLEANING Pi4J BUILDER v$VERSION (DOCKER IMAGE) *" -echo "**********************************************************************" -echo - -# remove the builder instance -docker buildx rm pi4j-builder-$VERSION || true - -# remove any containers from local Docker registry -docker rmi --force pi4j/pi4j-builder:$VERSION diff --git a/pi4j-builder-2.0/Dockerfile b/pi4j-builder-2.0/Dockerfile index 1d6efd3..b5659dd 100644 --- a/pi4j-builder-2.0/Dockerfile +++ b/pi4j-builder-2.0/Dockerfile @@ -1,7 +1,7 @@ # --------------------------------------------------------------------------------- # NATIVE BUILDER IMAGE FOR Pi4J (cross-compilers for ARMHF & AARCH64) # --------------------------------------------------------------------------------- -FROM pi4j/pi4j-builder-native:2.0 +FROM pi4j/pi4j-builder-native:latest ARG TARGETARCH ARG BUILDDATE ARG BUILDVERSION diff --git a/pi4j-builder-2.0/build.sh b/pi4j-builder-2.0/build.sh index 70e6130..b139704 100755 --- a/pi4j-builder-2.0/build.sh +++ b/pi4j-builder-2.0/build.sh @@ -28,28 +28,6 @@ # #L% ### -#----------------------------------------------------------------------------------------- -# !! THIS DOCKER BUILD REQUIRES THE EXPERIMENTAL DOCKER BUILDX PLUGIN !! -#----------------------------------------------------------------------------------------- -# -# REF: https://docs.docker.com/buildx/working-with-buildx/ -# -# Docker Buildx is a CLI plugin that extends the docker command with the -# full support of the features provided by Moby BuildKit builder toolkit. -# It provides the same user experience as docker build with many new -# features like creating scoped builder instances and building against -# multiple nodes concurrently. -# -# This is an experimental feature. -# -# Experimental features provide early access to future product functionality. -# These features are intended for testing and feedback only as they may change -# between releases without warning or can be removed entirely from a future -# release. Experimental features must not be used in production environments. -# Docker does not offer support for experimental features. -# -#----------------------------------------------------------------------------------------- - # docker image version VERSION=2.0 @@ -59,20 +37,11 @@ echo "* BUILDING Pi4J v$VERSION BUILDER (DOCKER IMAGE) echo "**********************************************************************" echo -# use buildx to create a new builder instance; if needed -docker buildx create --driver-opt env.BUILDKIT_STEP_LOG_MAX_SIZE=10485760 \ - --driver-opt env.BUILDKIT_STEP_LOG_MAX_SPEED=100000000 \ - --use --name pi4j-builder-$VERSION || true; - -# perform multi-arch platform image builds; push the resulting image to the Pi4J DockerHub repository -# (https://hub.docker.com/r/pi4j/pi4j-builder) -docker buildx build \ +docker build \ --build-arg BUILDDATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')" \ --build-arg BUILDVERSION="$VERSION" \ - --platform linux/amd64,linux/arm64 \ --tag pi4j/pi4j-builder:$VERSION \ - --tag pi4j/pi4j-builder:latest . $@ - -# remove the builder instance when completed -#docker buildx rm pi4j-builder-$VERSION -#docker buildx rm pi4j-builder-latest \ No newline at end of file + --tag pi4j/pi4j-builder:latest \ + . $@ +# --builder=pi4j-builder --load . $@ +# --platform linux/amd64,linux/arm64 \ diff --git a/pi4j-builder-base/Dockerfile b/pi4j-builder-base/Dockerfile index 054426d..8624d5b 100644 --- a/pi4j-builder-base/Dockerfile +++ b/pi4j-builder-base/Dockerfile @@ -1,7 +1,7 @@ # --------------------------------------------------------------------------------- # NATIVE BUILDER IMAGE FOR Pi4J (cross-compilers for ARMHF & AARCH64) # --------------------------------------------------------------------------------- -FROM ubuntu:18.04 +FROM ubuntu:22.04 ARG TARGETARCH ARG BUILDDATE ARG BUILDVERSION @@ -27,11 +27,11 @@ RUN apt-get update && \ apt-get install --yes apt-utils # install additional build tools and utilities -RUN apt-get install --yes git build-essential tree nano file curl wget +RUN apt-get install --yes git build-essential tree nano file curl wget libgpiod-dev gcc-multilib -# install OpenJDK 11 (JDK) and configure JAVA_HOME environment variable -RUN apt-get install --yes openjdk-11-jdk-headless -ENV JAVA_HOME="/usr/lib/jvm/java-11-openjdk-$TARGETARCH/" +# install OpenJDK 21 (JDK) and configure JAVA_HOME environment variable +RUN apt-get install --yes openjdk-21-jdk-headless +ENV JAVA_HOME="/usr/lib/jvm/java-21-openjdk-$TARGETARCH/" # install Apache Maven RUN apt-get install --yes maven diff --git a/pi4j-builder-base/build.sh b/pi4j-builder-base/build.sh index c656eb6..df5eb67 100755 --- a/pi4j-builder-base/build.sh +++ b/pi4j-builder-base/build.sh @@ -28,31 +28,8 @@ # #L% ### - -#----------------------------------------------------------------------------------------- -# !! THIS DOCKER BUILD REQUIRES THE EXPERIMENTAL DOCKER BUILDX PLUGIN !! -#----------------------------------------------------------------------------------------- -# -# REF: https://docs.docker.com/buildx/working-with-buildx/ -# -# Docker Buildx is a CLI plugin that extends the docker command with the -# full support of the features provided by Moby BuildKit builder toolkit. -# It provides the same user experience as docker build with many new -# features like creating scoped builder instances and building against -# multiple nodes concurrently. -# -# This is an experimental feature. -# -# Experimental features provide early access to future product functionality. -# These features are intended for testing and feedback only as they may change -# between releases without warning or can be removed entirely from a future -# release. Experimental features must not be used in production environments. -# Docker does not offer support for experimental features. -# -#----------------------------------------------------------------------------------------- - # docker image version -VERSION=1.0 +VERSION=2.0 echo echo "**********************************************************************" @@ -60,20 +37,11 @@ echo "* BUILDING Pi4J BASE BUILDER (DOCKER IMAGE) *" echo "**********************************************************************" echo -# use buildx to create a new builder instance; if needed -docker buildx create --driver-opt env.BUILDKIT_STEP_LOG_MAX_SIZE=10485760 \ - --driver-opt env.BUILDKIT_STEP_LOG_MAX_SPEED=100000000 \ - --use --name pi4j-builder-base || true; - -# perform multi-arch platform image builds; push the resulting image to the Pi4J DockerHub repository -# (https://hub.docker.com/r/pi4j/pi4j-builder-base) -docker buildx build \ +docker build \ --build-arg BUILDDATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')" \ - --build-arg BUILDVERSION="1.0" \ - --platform linux/amd64,linux/arm64 \ + --build-arg BUILDVERSION="$VERSION" \ --tag pi4j/pi4j-builder-base:$VERSION \ - --tag pi4j/pi4j-builder-base:latest . $@ - -# remove the builder instance when completed -#docker buildx rm pi4j-builder-base:$VERSION -#docker buildx rm pi4j-builder-base:latest \ No newline at end of file + --tag pi4j/pi4j-builder-base:latest \ + . $@ +# --builder=pi4j-builder --load . $@ +# --platform linux/amd64,linux/arm64 \ diff --git a/pi4j-builder-native/build.sh b/pi4j-builder-native/build.sh index 8e71088..2e65827 100755 --- a/pi4j-builder-native/build.sh +++ b/pi4j-builder-native/build.sh @@ -28,29 +28,6 @@ # #L% ### - -#----------------------------------------------------------------------------------------- -# !! THIS DOCKER BUILD REQUIRES THE EXPERIMENTAL DOCKER BUILDX PLUGIN !! -#----------------------------------------------------------------------------------------- -# -# REF: https://docs.docker.com/buildx/working-with-buildx/ -# -# Docker Buildx is a CLI plugin that extends the docker command with the -# full support of the features provided by Moby BuildKit builder toolkit. -# It provides the same user experience as docker build with many new -# features like creating scoped builder instances and building against -# multiple nodes concurrently. -# -# This is an experimental feature. -# -# Experimental features provide early access to future product functionality. -# These features are intended for testing and feedback only as they may change -# between releases without warning or can be removed entirely from a future -# release. Experimental features must not be used in production environments. -# Docker does not offer support for experimental features. -# -#----------------------------------------------------------------------------------------- - # docker image version VERSION=2.0 @@ -60,22 +37,11 @@ echo "* BUILDING Pi4J NATIVE BUILDER (DOCKER IMAGE) *" echo "**********************************************************************" echo -# use buildx to create a new builder instance; if needed -docker buildx create --driver-opt env.BUILDKIT_STEP_LOG_MAX_SIZE=10485760 \ - --driver-opt env.BUILDKIT_STEP_LOG_MAX_SPEED=100000000 \ - --use --name pi4j-builder-native || true; - -# perform multi-arch platform image builds; push the resulting image to the Pi4J DockerHub repository -# (https://hub.docker.com/r/pi4j/pi4j-native-builder) -docker buildx build \ +docker build \ --build-arg BUILDDATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')" \ --build-arg BUILDVERSION="$VERSION" \ - --platform linux/amd64,linux/arm64 \ - --tag pi4j/pi4j-builder-native:1.4 \ --tag pi4j/pi4j-builder-native:$VERSION \ - --tag pi4j/pi4j-builder-native:latest . $@ - -# remove the builder instance when completed -#docker buildx rm pi4j-builder-native:$VERSION -#docker buildx rm pi4j-builder-native:1.4 -#docker buildx rm pi4j-builder-native:latest \ No newline at end of file + --tag pi4j/pi4j-builder-native:latest \ + . $@ +# --builder=pi4j-builder --load . $@ +# --platform linux/amd64,linux/arm64 \ diff --git a/pi4j-builder-native/clean.sh b/pi4j-builder-native/clean.sh index 67b0f34..c2a4a8c 100755 --- a/pi4j-builder-native/clean.sh +++ b/pi4j-builder-native/clean.sh @@ -64,6 +64,5 @@ echo docker buildx rm pi4j-builder-native || true # remove any containers from local Docker registry -docker rmi --force pi4j/pi4j-builder-native:1.4 docker rmi --force pi4j/pi4j-builder-native:$VERSION docker rmi --force pi4j/pi4j-builder-native:latest diff --git a/pi4j-builder-repo/Dockerfile b/pi4j-builder-repo/Dockerfile index b4f611b..9dd7186 100644 --- a/pi4j-builder-repo/Dockerfile +++ b/pi4j-builder-repo/Dockerfile @@ -1,7 +1,7 @@ # --------------------------------------------------------------------------------- # REPO BUILDER IMAGE FOR Pi4J (AARCH64) # --------------------------------------------------------------------------------- -FROM ubuntu:18.04 +FROM ubuntu:22.04 ARG TARGETARCH ARG BUILDDATE ARG BUILDVERSION diff --git a/pi4j-builder-repo/build.sh b/pi4j-builder-repo/build.sh index 35bac58..3bfbbd3 100755 --- a/pi4j-builder-repo/build.sh +++ b/pi4j-builder-repo/build.sh @@ -28,31 +28,8 @@ # #L% ### - -#----------------------------------------------------------------------------------------- -# !! THIS DOCKER BUILD REQUIRES THE EXPERIMENTAL DOCKER BUILDX PLUGIN !! -#----------------------------------------------------------------------------------------- -# -# REF: https://docs.docker.com/buildx/working-with-buildx/ -# -# Docker Buildx is a CLI plugin that extends the docker command with the -# full support of the features provided by Moby BuildKit builder toolkit. -# It provides the same user experience as docker build with many new -# features like creating scoped builder instances and building against -# multiple nodes concurrently. -# -# This is an experimental feature. -# -# Experimental features provide early access to future product functionality. -# These features are intended for testing and feedback only as they may change -# between releases without warning or can be removed entirely from a future -# release. Experimental features must not be used in production environments. -# Docker does not offer support for experimental features. -# -#----------------------------------------------------------------------------------------- - # docker image version -VERSION=1.0 +VERSION=2.0 echo echo "**********************************************************************" @@ -60,20 +37,12 @@ echo "* BUILDING Pi4J REPO BUILDER (DOCKER IMAGE) *" echo "**********************************************************************" echo -# use buildx to create a new builder instance; if needed -docker buildx create --driver-opt env.BUILDKIT_STEP_LOG_MAX_SIZE=10485760 \ - --driver-opt env.BUILDKIT_STEP_LOG_MAX_SPEED=100000000 \ - --use --name pi4j-builder-repo || true; - -# perform multi-arch platform image builds; push the resulting image to the Pi4J DockerHub repository -# (https://hub.docker.com/r/pi4j/pi4j-builder-base) -docker buildx build \ +docker build \ --build-arg BUILDDATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')" \ --build-arg BUILDVERSION="1.0" \ --platform linux/amd64 \ --tag pi4j/pi4j-builder-repo:$VERSION \ - --tag pi4j/pi4j-builder-repo:latest . $@ - -# remove the builder instance when completed -#docker buildx rm pi4j-builder-repo:$VERSION -#docker buildx rm pi4j-builder-repo:latest \ No newline at end of file + --tag pi4j/pi4j-builder-repo:latest \ + . $@ +# --builder=pi4j-builder --load . $@ +# --platform linux/amd64,linux/arm64 \ From 26b3cbf0c976f05c45e7fd1ae7772c810411108a Mon Sep 17 00:00:00 2001 From: alex9849 Date: Mon, 5 Feb 2024 18:21:37 +0100 Subject: [PATCH 2/5] Updated builder --- pi4j-builder-base/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pi4j-builder-base/Dockerfile b/pi4j-builder-base/Dockerfile index 8624d5b..be9ec40 100644 --- a/pi4j-builder-base/Dockerfile +++ b/pi4j-builder-base/Dockerfile @@ -27,7 +27,7 @@ RUN apt-get update && \ apt-get install --yes apt-utils # install additional build tools and utilities -RUN apt-get install --yes git build-essential tree nano file curl wget libgpiod-dev gcc-multilib +RUN apt-get install --yes git build-essential tree nano file curl wget autoconf autoconf-archive libtool pkg-config gcc-multilib # install OpenJDK 21 (JDK) and configure JAVA_HOME environment variable RUN apt-get install --yes openjdk-21-jdk-headless From 31a6161e4ff03211d77bff81bd285798a8bbe9e7 Mon Sep 17 00:00:00 2001 From: alex9849 Date: Mon, 5 Feb 2024 21:47:01 +0100 Subject: [PATCH 3/5] Replaced raspberrypi tools compiler with gcc-arm-linux-gnueabihf and added libgpiod-dev --- pi4j-builder-base/Dockerfile | 2 +- pi4j-builder-native/Dockerfile | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/pi4j-builder-base/Dockerfile b/pi4j-builder-base/Dockerfile index be9ec40..53d1fc3 100644 --- a/pi4j-builder-base/Dockerfile +++ b/pi4j-builder-base/Dockerfile @@ -27,7 +27,7 @@ RUN apt-get update && \ apt-get install --yes apt-utils # install additional build tools and utilities -RUN apt-get install --yes git build-essential tree nano file curl wget autoconf autoconf-archive libtool pkg-config gcc-multilib +RUN apt-get install --yes git build-essential tree nano file curl wget autoconf autoconf-archive libtool pkg-config gcc-multilib libgpiod-dev # install OpenJDK 21 (JDK) and configure JAVA_HOME environment variable RUN apt-get install --yes openjdk-21-jdk-headless diff --git a/pi4j-builder-native/Dockerfile b/pi4j-builder-native/Dockerfile index 4251296..c2a267f 100644 --- a/pi4j-builder-native/Dockerfile +++ b/pi4j-builder-native/Dockerfile @@ -25,21 +25,20 @@ RUN apt-get update #RUN apt-get install --yes gcc-arm-linux-gnueabi # install ARM cross compiler toolchains for 32-bit ARMHF -#RUN apt-get install --yes gcc-arm-linux-gnueabihf +RUN apt-get install --yes gcc-arm-linux-gnueabihf # install ARM cross compiler toolchains for 64-bit ARM64 -# (only install on amd64 platforms) -RUN if [ "$TARGETARCH" = "amd64" ] ; then apt-get --yes install gcc-aarch64-linux-gnu ; fi +RUN apt-get install --yes gcc-aarch64-linux-gnu # install RaspberryPi ARM cross compiler toolchains for 32-bit ARMHF (ARMv6+ARMv7+ARMv8) # (get the latest RPI cross compiler tools from the GitHub repo) -RUN git clone --progress --verbose https://github.com/raspberrypi/tools.git --depth=1 /opt/rpi-tools +#RUN git clone --progress --verbose https://github.com/raspberrypi/tools.git --depth=1 /opt/rpi-tools # clean APT cache RUN apt-get clean # configure the PATH for ARM cross compiler toolchains for 32-bit ARMHF (ARMv6 + ARMv7) -ENV PATH="/opt/rpi-tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin:${PATH}" +#ENV PATH="/opt/rpi-tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin:${PATH}" # configure build time environment variables ENV PI4J_BUILDER_NATIVE="$BUILDVERSION" From ec978dd7ce12904646be53fe7f45ddaa0a632f60 Mon Sep 17 00:00:00 2001 From: alex9849 Date: Mon, 5 Feb 2024 22:53:12 +0100 Subject: [PATCH 4/5] reactivated main builder --- build.sh | 6 +++--- pi4j-builder-2.0/Dockerfile | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build.sh b/build.sh index be58308..261e4d5 100755 --- a/build.sh +++ b/build.sh @@ -80,8 +80,8 @@ cd $BASE_DIR/pi4j-builder-native # ********************************************************************** # BUILDING Pi4J v2.0 BUILDER (DOCKER IMAGE) # ********************************************************************** -#cd $BASE_DIR/pi4j-builder-2.0 -#./build.sh $@ +cd $BASE_DIR/pi4j-builder-2.0 +./build.sh $@ # ********************************************************************** # BUILDING Pi4J REPO BUILDER (DOCKER IMAGE) @@ -97,4 +97,4 @@ echo "* *" echo "* FINISHED BUILDING ALL Pi4J BUILDERS (DOCKER IMAGES) *" echo "* *" echo "**********************************************************************" -echo \ No newline at end of file +echo diff --git a/pi4j-builder-2.0/Dockerfile b/pi4j-builder-2.0/Dockerfile index b5659dd..1a1c5fc 100644 --- a/pi4j-builder-2.0/Dockerfile +++ b/pi4j-builder-2.0/Dockerfile @@ -32,7 +32,7 @@ RUN echo "=========================================================" # repository cache as part of the container image RUN git clone --single-branch --branch main https://github.com/Pi4J/pi4j-v2 /pi4j RUN cd /pi4j && \ - mvn dependency:resolve dependency:resolve-plugins -DexcludeGroupIds="com.pi4j" -Pnative && \ + mvn dependency:go-offline -DexcludeGroupIds=com.pi4j -Pnative && \ rm -R /pi4j # ensure read/write access permissions to the M2 repository cache for all users From 65cee2b0a3cb520927ebaeeb7d6194729332b7a2 Mon Sep 17 00:00:00 2001 From: alex9849 Date: Tue, 6 Feb 2024 09:10:22 +0100 Subject: [PATCH 5/5] removed libgpiod dependency --- pi4j-builder-base/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pi4j-builder-base/Dockerfile b/pi4j-builder-base/Dockerfile index 53d1fc3..be9ec40 100644 --- a/pi4j-builder-base/Dockerfile +++ b/pi4j-builder-base/Dockerfile @@ -27,7 +27,7 @@ RUN apt-get update && \ apt-get install --yes apt-utils # install additional build tools and utilities -RUN apt-get install --yes git build-essential tree nano file curl wget autoconf autoconf-archive libtool pkg-config gcc-multilib libgpiod-dev +RUN apt-get install --yes git build-essential tree nano file curl wget autoconf autoconf-archive libtool pkg-config gcc-multilib # install OpenJDK 21 (JDK) and configure JAVA_HOME environment variable RUN apt-get install --yes openjdk-21-jdk-headless