Pi4J Build Environment Docker Images (java, maven, gcc ARM cross-compilers, etc.)
Find a file
Robert von Burg 1f8cf6ff8d
Some checks failed
Continuous Integration / Build `pi4j-builder-base` (push) Has been cancelled
Continuous Integration / Build `pi4j-builder-native` (push) Has been cancelled
Continuous Integration / Build `pi4j-builder-2.0` (push) Has been cancelled
[Minor] Upgrade base image to Zulu JDK 25 and update JAVA_HOME path
2025-10-01 16:16:59 +02:00
.github/workflows Update version qemu 2024-02-06 11:39:54 +01:00
pi4j-builder-2.0 Revert to pre-FFM state 2025-07-12 17:43:01 +03:00
pi4j-builder-base [Minor] Upgrade base image to Zulu JDK 25 and update JAVA_HOME path 2025-10-01 16:16:59 +02:00
pi4j-builder-native Bump to OpenJDK 24 2025-03-26 09:58:34 +01:00
pi4j-builder-repo Bump to OpenJDK 24 2025-03-26 09:58:34 +01:00
.dockerignore initial commit 2020-06-25 20:46:54 -04:00
.gitignore initial commit 2020-06-25 20:46:54 -04:00
build.sh reactivated main builder 2024-02-05 22:53:12 +01:00
clean.sh added a docker container for re-building APT repository 2021-01-30 00:34:37 -05:00
deploy.sh initial commit 2020-06-25 20:46:54 -04:00
README.md cleanup 2024-02-06 11:31:54 +01:00

Pi4J Docker Builder Images


Overview:

This project contains the Dockerfiles and build scripts to create the Pi4J builder
docker images used for compiling/building the Pi4J projects. The Pi4J builder images include the following:

  • Pi4J Base Builder pi4j/pi4j-builder-base:latest : 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 pi4j/pi4j-builder-native:latest : This image is derived from pi4j/pi4j-builder-base and adds support for native cross-compilers 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 v2.0 Builder 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 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 native library projects which will be cross-compiled for RaspberryPi/ARM (32-bit & 64-bit) devices.

Note: Pi4J versions prior to v2.0 are not supported in these Docker images.

How to Build the Pi4J Project using these Docker Images:

Build Pi4J v2.0

Navigate to the parent "pi4j" directory and execute the following Docker commands:

docker pull pi4j/pi4j-builder:2.0
docker run \\
    --user "$(id -u):$(id -g)" \
    --rm \
    --volume $(pwd):/build \
    pi4j/pi4j-builder:2.0
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:2.0 The Pi4J build container image name and version.

How to Build the Pi4J Docker Builder Images:

The Pi4J Docker Builder images are built using the following shell scripts:

Docker Command Argument Description
./build.sh builds all the Pi4J Builder images locally for: x86_64/amd64 & aarch64/arm64 architectures.
./deploy.sh builds all the Pi4J Builder images and pushes to DockerHub for: x86_64/amd64 & aarch64/arm64 architectures.
./clean.sh cleans the build environment and removes images from the local system for all the Pi4J Builder images.
./pi4j-builder-base/build.sh builds the Pi4J Base Builder image locally for: x86_64/amd64 & aarch64/arm64 architectures.
./pi4j-builder-base/build.sh --push builds the Pi4J Base Builder images and pushes to DockerHub for: x86_64/amd64 & aarch64/arm64 architectures.
./pi4j-builder-base/clean.sh cleans the build environment and removes images from the local system for the Pi4J Base Builder image.
./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-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.