From ade66f941d93971fdb4da6db10254a0ac8fb06f1 Mon Sep 17 00:00:00 2001 From: "Mark S. Lewis" Date: Thu, 24 Sep 2026 22:15:44 +0100 Subject: [PATCH 1/4] Update tools and dependencies in Docker image An update to the Gradle version is required for Java chaincode to be able to use the latest Shadow Gradle plugin. This change also updates all the other tool and dependency versions in the Dockerfile to current versions. Signed-off-by: Mark S. Lewis --- .github/workflows/pr.yml | 8 ++-- Dockerfile2 | 55 ++++++++++++++++++---------- internal/pkg/configtxlator/update.go | 50 ++++++++++++------------- 3 files changed, 65 insertions(+), 48 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 805a7b7..1d1644f 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -22,19 +22,19 @@ jobs: - uses: actions/setup-java@v4 with: distribution: temurin - java-version: 17 + java-version: 25 - uses: actions/setup-node@v4 with: - node-version: 22 + node-version: 24 - name: Install Fabric dependencies run: | sudo mkdir -p /opt/fabric pushd /opt/fabric - curl -sSL https://raw.githubusercontent.com/hyperledger/fabric/main/scripts/install-fabric.sh | bash -s -- binary --fabric-version 2.5.10 --ca-version 1.5.13 + curl -sSL https://raw.githubusercontent.com/hyperledger/fabric/main/scripts/install-fabric.sh | bash -s -- binary --fabric-version 2.5.16 --ca-version 1.5.22 popd cd builders/java sudo mvn -q dependency:copy-dependencies -DoutputDirectory=/opt/fabric-chaincode-java/lib - npm install -g fabric-shim@2.5.7 + npm install -g fabric-shim@2.5.8 - name: Run Go formatters and linters run: make lint - name: Run Go unit tests diff --git a/Dockerfile2 b/Dockerfile2 index 3db4072..c5efb20 100644 --- a/Dockerfile2 +++ b/Dockerfile2 @@ -2,27 +2,39 @@ # SPDX-License-Identifier: Apache-2.0 # -FROM debian:bookworm-slim AS builder +ARG GO_VERSION=1.27.1 +ARG FABRIC_VERSION=2.5.16 +ARG FABRIC_CA_VERSION=1.5.22 +ARG COUCHDB_VERSION=3.5 +ARG NODE_VERSION=24.21.0 +ARG GRADLE_VERSION=9.8.0 +ARG MAVEN_VERSION=3.9.16 +ARG NODE_FABRIC_SHIM_VERSION=2.5.8 + +FROM debian:trixie-slim AS builder ENV DEBIAN_FRONTEND=noninteractive ARG TARGETARCH ARG TARGETOS +ARG GO_VERSION +ARG FABRIC_VERSION +ARG FABRIC_CA_VERSION + # Build tools RUN apt-get update \ && apt-get -y install build-essential gcc gzip \ - && apt-get -y install python3 python3-distutils libpython3-dev software-properties-common \ && apt-get -y install curl git jq unzip moreutils -RUN curl -sL https://go.dev/dl/go1.23.3.${TARGETOS}-${TARGETARCH}.tar.gz | tar zxf - -C /usr/local +RUN curl -sSL https://go.dev/dl/go${GO_VERSION}.${TARGETOS}-${TARGETARCH}.tar.gz | tar zxf - -C /usr/local ENV PATH="/usr/local/go/bin:$PATH" ENV GOROOT=/usr/local/go ENV GOPATH=/tmp/go WORKDIR $GOPATH/src/github.com/hyperledger -RUN git clone --depth 1 --branch release-2.5 https://github.com/hyperledger/fabric.git \ - && git clone --depth 1 --branch v1.5.13 https://github.com/hyperledger/fabric-ca.git +RUN git clone --depth 1 --branch v${FABRIC_VERSION} https://github.com/hyperledger/fabric.git \ + && git clone --depth 1 --branch v${FABRIC_CA_VERSION} https://github.com/hyperledger/fabric-ca.git WORKDIR $GOPATH/src/github.com/hyperledger/fabric ENV CGO_ENABLED=0 RUN make orderer \ @@ -39,14 +51,20 @@ ADD . $GOPATH/src/github.com/hyperledger-labs/microfab RUN go build -o microfabd cmd/microfabd/main.go WORKDIR /fabric -RUN curl -sSL https://github.com/hyperledger/fabric/releases/download/v2.5.10/hyperledger-fabric-linux-amd64-2.5.10.tar.gz | tar xzf - config +RUN curl -sSL https://github.com/hyperledger/fabric/releases/download/v${FABRIC_VERSION}/hyperledger-fabric-linux-amd64-${FABRIC_VERSION}.tar.gz | tar xzf - config -FROM couchdb:3.4 +FROM couchdb:${COUCHDB_VERSION} # Though they are populated by docker buildx, the ARG reference is required to make them available for use ARG TARGETARCH ARG TARGETOS +ARG GO_VERSION +ARG NODE_VERSION +ARG GRADLE_VERSION +ARG MAVEN_VERSION +ARG NODE_FABRIC_SHIM_VERSION + RUN apt-get update && apt-get install -y \ jq xz-utils unzip vim \ && rm -rf /var/lib/apt/lists/* @@ -57,16 +75,16 @@ RUN groupadd -g 7051 microfab \ && chown -R microfab:microfab /home/microfab RUN mkdir -p /opt/go /opt/node /opt/java \ - && curl -sSL https://dl.google.com/go/go1.23.3.$TARGETOS-$TARGETARCH.tar.gz | tar xzf - -C /opt/go --strip-components=1 + && curl -sSL https://go.dev/dl/go${GO_VERSION}.${TARGETOS}-${TARGETARCH}.tar.gz | tar xzf - -C /opt/go --strip-components=1 RUN if [ "${TARGETARCH}" = "amd64" ]; then ARCH=x64 \ - && curl -sSL https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.5%2B11/OpenJDK21U-jdk_${ARCH}_${TARGETOS}_hotspot_21.0.5_11.tar.gz | tar xzf - -C /opt/java --strip-components=1 \ - && curl -sSL https://nodejs.org/download/release/v22.11.0/node-v22.11.0-${TARGETOS}-${ARCH}.tar.xz | tar xJf - -C /opt/node --strip-components=1 \ + && curl -sSL https://github.com/adoptium/temurin25-binaries/releases/download/jdk-25.0.4.1%2B1/OpenJDK25U-jdk_${ARCH}_${TARGETOS}_hotspot_25.0.4.1_1.tar.gz | tar xzf - -C /opt/java --strip-components=1 \ + && curl -sSL https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-${TARGETOS}-${ARCH}.tar.xz | tar xJf - -C /opt/node --strip-components=1 \ ; elif [ "${TARGETARCH}" = "arm64" ]; then ARCH=aarch64 \ - && curl -sSL https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.5%2B11/OpenJDK21U-jdk_${ARCH}_${TARGETOS}_hotspot_21.0.5_11.tar.gz | tar xzf - -C /opt/java --strip-components=1 \ - && curl -sSL https://nodejs.org/download/release/v22.11.0/node-v22.11.0-${TARGETOS}-${TARGETARCH}.tar.xz | tar xJf - -C /opt/node --strip-components=1 \ + && curl -sSL https://github.com/adoptium/temurin21-binaries/releases/download/jdk-25.0.4.1%2B1/OpenJDK25U-jdk_${ARCH}_${TARGETOS}_hotspot_25.0.4.1_1.tar.gz | tar xzf - -C /opt/java --strip-components=1 \ + && curl -sSL https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-${TARGETOS}-${TARGETARCH}.tar.xz | tar xJf - -C /opt/node --strip-components=1 \ ; fi - + COPY docker/local.ini /opt/couchdb/etc/local.d/local.ini COPY docker/docker-entrypoint.sh /usr/local/bin COPY --from=builder /tmp/go/src/github.com/hyperledger/fabric/build/bin/* /usr/local/bin/ @@ -83,19 +101,18 @@ ENV FABRIC_CFG_PATH=/etc/hyperledger/fabric ENV MICROFAB_HOME=/home/microfab ENV PATH=/opt/go/bin:/opt/node/bin:/opt/java/bin:/opt/couchdb/bin:${PATH} - -RUN curl -sSL -o /tmp/gradle.zip https://services.gradle.org/distributions/gradle-8.11.1-bin.zip \ +RUN curl -sSL -o /tmp/gradle.zip https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip \ && unzip -qq /tmp/gradle.zip -d /opt \ - && mv /opt/gradle-8.11.1 /opt/gradle \ + && mv /opt/gradle-${GRADLE_VERSION} /opt/gradle \ && rm -f /tmp/gradle.zip \ - && curl -sSL https://dlcdn.apache.org/maven/maven-3/3.9.9/binaries/apache-maven-3.9.9-bin.tar.gz | tar xzf - -C /opt \ - && mv /opt/apache-maven-3.9.9 /opt/maven + && curl -sSL https://dlcdn.apache.org/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz | tar xzf - -C /opt \ + && mv /opt/apache-maven-${MAVEN_VERSION} /opt/maven ENV PATH=/opt/gradle/bin:/opt/maven/bin:${PATH} ADD builders/java/pom.xml /opt/fabric-chaincode-java/ RUN cd /opt/fabric-chaincode-java \ && mvn -q dependency:copy-dependencies -DoutputDirectory=/opt/fabric-chaincode-java/lib \ - && npm install --unsafe-perm -g fabric-shim@2.5.7 \ + && npm install --unsafe-perm -g fabric-shim@${NODE_FABRIC_SHIM_VERSION} \ && rm -rf /tmp/gocache /tmp/goenv /tmp/go /tmp/maven /tmp/npm-cache /tmp/npm-devdir RUN chmod 666 /etc/passwd diff --git a/internal/pkg/configtxlator/update.go b/internal/pkg/configtxlator/update.go index 015fdaa..a74ab2e 100644 --- a/internal/pkg/configtxlator/update.go +++ b/internal/pkg/configtxlator/update.go @@ -166,23 +166,23 @@ func computeGroupUpdate(original, updated *cb.ConfigGroup) (readSet, writeSet *c len(readSetGroups) == 0 && len(writeSetGroups) == 0 { return &cb.ConfigGroup{ - Version: original.Version, - }, &cb.ConfigGroup{ - Version: original.Version, - }, false + Version: original.Version, + }, &cb.ConfigGroup{ + Version: original.Version, + }, false } return &cb.ConfigGroup{ - Version: original.Version, - Policies: readSetPolicies, - Values: readSetValues, - Groups: readSetGroups, - }, &cb.ConfigGroup{ - Version: original.Version, - Policies: writeSetPolicies, - Values: writeSetValues, - Groups: writeSetGroups, - }, true + Version: original.Version, + Policies: readSetPolicies, + Values: readSetValues, + Groups: readSetGroups, + }, &cb.ConfigGroup{ + Version: original.Version, + Policies: writeSetPolicies, + Values: writeSetValues, + Groups: writeSetGroups, + }, true } for k, samePolicy := range sameSetPolicies { @@ -201,17 +201,17 @@ func computeGroupUpdate(original, updated *cb.ConfigGroup) (readSet, writeSet *c } return &cb.ConfigGroup{ - Version: original.Version, - Policies: readSetPolicies, - Values: readSetValues, - Groups: readSetGroups, - }, &cb.ConfigGroup{ - Version: original.Version + 1, - Policies: writeSetPolicies, - Values: writeSetValues, - Groups: writeSetGroups, - ModPolicy: updated.ModPolicy, - }, true + Version: original.Version, + Policies: readSetPolicies, + Values: readSetValues, + Groups: readSetGroups, + }, &cb.ConfigGroup{ + Version: original.Version + 1, + Policies: writeSetPolicies, + Values: writeSetValues, + Groups: writeSetGroups, + ModPolicy: updated.ModPolicy, + }, true } // Compute computes a config update between the specified original and updated config. From 339dfb204db05d93c5dc79f5feef96f98d4d8749 Mon Sep 17 00:00:00 2001 From: "Mark S. Lewis" Date: Thu, 24 Sep 2026 22:38:53 +0100 Subject: [PATCH 2/4] Update Java fabric-chaincode-shim version Signed-off-by: Mark S. Lewis --- builders/java/pom.xml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/builders/java/pom.xml b/builders/java/pom.xml index 6dd0ad4..81ae6e8 100644 --- a/builders/java/pom.xml +++ b/builders/java/pom.xml @@ -11,14 +11,8 @@ org.hyperledger.fabric-chaincode-java fabric-chaincode-shim - 2.4.1 + 2.5.11 runtime - - - jitpack.io - https://jitpack.io - - From 11d891435db3126164eb0f5929e66f668a870c15 Mon Sep 17 00:00:00 2001 From: "Mark S. Lewis" Date: Thu, 24 Sep 2026 23:19:27 +0100 Subject: [PATCH 3/4] Fix go lint error Signed-off-by: Mark S. Lewis --- pkg/microfab/util.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/microfab/util.go b/pkg/microfab/util.go index 14e0844..2933ba6 100644 --- a/pkg/microfab/util.go +++ b/pkg/microfab/util.go @@ -62,7 +62,7 @@ func DownloadImage(microFabImage string) error { var s PullStatus json.Unmarshal(buf.Bytes(), &s) if strings.HasPrefix(s.Status, "Status: Downloaded") { - log.Printf(s.Status) + log.Print(s.Status) } } From 5975c57f3a7a3c37a4874a391a90b7cd8f4fa41b Mon Sep 17 00:00:00 2001 From: "Mark S. Lewis" Date: Fri, 25 Sep 2026 10:34:43 +0100 Subject: [PATCH 4/4] Tidy up Dockerfile - Use a more full featured image for the builder. - Remove unnecessary package installs. - Simplify Java install. Signed-off-by: Mark S. Lewis --- Dockerfile2 | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Dockerfile2 b/Dockerfile2 index c5efb20..17d393e 100644 --- a/Dockerfile2 +++ b/Dockerfile2 @@ -11,7 +11,7 @@ ARG GRADLE_VERSION=9.8.0 ARG MAVEN_VERSION=3.9.16 ARG NODE_FABRIC_SHIM_VERSION=2.5.8 -FROM debian:trixie-slim AS builder +FROM debian:trixie AS builder ENV DEBIAN_FRONTEND=noninteractive ARG TARGETARCH @@ -23,8 +23,7 @@ ARG FABRIC_CA_VERSION # Build tools RUN apt-get update \ - && apt-get -y install build-essential gcc gzip \ - && apt-get -y install curl git jq unzip moreutils + && apt-get -y install build-essential curl git jq unzip RUN curl -sSL https://go.dev/dl/go${GO_VERSION}.${TARGETOS}-${TARGETARCH}.tar.gz | tar zxf - -C /usr/local ENV PATH="/usr/local/go/bin:$PATH" @@ -77,11 +76,11 @@ RUN groupadd -g 7051 microfab \ RUN mkdir -p /opt/go /opt/node /opt/java \ && curl -sSL https://go.dev/dl/go${GO_VERSION}.${TARGETOS}-${TARGETARCH}.tar.gz | tar xzf - -C /opt/go --strip-components=1 +COPY --from=eclipse-temurin:25-jdk /opt/java/openjdk /opt/java + RUN if [ "${TARGETARCH}" = "amd64" ]; then ARCH=x64 \ - && curl -sSL https://github.com/adoptium/temurin25-binaries/releases/download/jdk-25.0.4.1%2B1/OpenJDK25U-jdk_${ARCH}_${TARGETOS}_hotspot_25.0.4.1_1.tar.gz | tar xzf - -C /opt/java --strip-components=1 \ && curl -sSL https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-${TARGETOS}-${ARCH}.tar.xz | tar xJf - -C /opt/node --strip-components=1 \ ; elif [ "${TARGETARCH}" = "arm64" ]; then ARCH=aarch64 \ - && curl -sSL https://github.com/adoptium/temurin21-binaries/releases/download/jdk-25.0.4.1%2B1/OpenJDK25U-jdk_${ARCH}_${TARGETOS}_hotspot_25.0.4.1_1.tar.gz | tar xzf - -C /opt/java --strip-components=1 \ && curl -sSL https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-${TARGETOS}-${TARGETARCH}.tar.xz | tar xJf - -C /opt/node --strip-components=1 \ ; fi