diff --git a/Dockerfile2 b/Dockerfile2 index d0001e1..4f08318 100644 --- a/Dockerfile2 +++ b/Dockerfile2 @@ -2,16 +2,24 @@ # SPDX-License-Identifier: Apache-2.0 # - -FROM golang:1.18 AS builder +FROM debian:bullseye-slim AS builder ENV DEBIAN_FRONTEND=noninteractive +ARG TARGETARCH +ARG TARGETOS + # 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.22.3.${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.5 https://github.com/hyperledger/fabric-ca.git @@ -31,21 +39,16 @@ ADD . $GOPATH/src/github.com/IBM/microfab RUN go build -o microfabd cmd/microfabd/main.go WORKDIR /fabric -RUN curl -sSL https://github.com/hyperledger/fabric/releases/download/v2.4.6/hyperledger-fabric-linux-amd64-2.4.6.tar.gz | tar xzf - config - - -# RUN FABRIC_DOCKER_REGISTRY=ghcr.io/hyperledger \ -# curl -sSL https://raw.githubusercontent.com/hyperledger/fabric/main/scripts/install-fabric.sh \ -# | bash -s -- binary --fabric-version 2.5.0-alpha1 --ca-version 1.5.6-beta +RUN curl -sSL https://github.com/hyperledger/fabric/releases/download/v2.5.7/hyperledger-fabric-linux-amd64-2.5.7.tar.gz | tar xzf - config -FROM couchdb:3.1.2 +FROM couchdb:3.3.3 # Though they are populated by docker buildx, the ARG reference is required to make them available for use ARG TARGETARCH ARG TARGETOS RUN apt-get update && apt-get install -y \ - jq xz-utils unzip vim\ + jq xz-utils unzip vim \ && rm -rf /var/lib/apt/lists/* RUN groupadd -g 7051 microfab \ @@ -53,35 +56,33 @@ RUN groupadd -g 7051 microfab \ && mkdir -p /home/microfab/builders /home/microfab/data \ && chown -R microfab:microfab /home/microfab -# go1.19.4.linux-amd64.tar.gz -# go1.19.4.linux-arm64.tar.gz RUN mkdir -p /opt/go /opt/node /opt/java \ - && curl -sSL https://dl.google.com/go/go1.17.2.$TARGETOS-$TARGETARCH.tar.gz | tar xzf - -C /opt/go --strip-components=1 + && curl -sSL https://dl.google.com/go/go1.22.3.$TARGETOS-$TARGETARCH.tar.gz | tar xzf - -C /opt/go --strip-components=1 # OpenJDK11U-jdk_x64_linux_hotspot_11.0.17_8.tar.gz # node-v18.12.1-linux-x64.tar.xz RUN if [ "${TARGETARCH}" = "amd64" ]; then ARCH=x64 \ && curl -sSL https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.17%2B8/OpenJDK11U-jdk_${ARCH}_${TARGETOS}_hotspot_11.0.17_8.tar.gz | tar xzf - -C /opt/java --strip-components=1 \ - && curl -sSL https://nodejs.org/download/release/v16.4.0/node-v16.4.0-${TARGETOS}-${ARCH}.tar.xz | tar xJf - -C /opt/node --strip-components=1 \ + && curl -sSL https://nodejs.org/download/release/v20.14.0/node-v20.14.0-${TARGETOS}-${ARCH}.tar.xz | tar xJf - -C /opt/node --strip-components=1 \ ; fi # node-v18.12.1-linux-arm64.tar.xz # OpenJDK11U-jdk_aarch64_linux_hotspot_11.0.17_8.tar.gz RUN if [ "${TARGETARCH}" = "arm64" ]; then ARCH=aarch64 \ && curl -sSL https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.17%2B8/OpenJDK11U-jdk_${ARCH}_${TARGETOS}_hotspot_11.0.17_8.tar.gz | tar xzf - -C /opt/java --strip-components=1 \ - && curl -sSL https://nodejs.org/download/release/v16.4.0/node-v16.4.0-${TARGETOS}-${TARGETARCH}.tar.xz | tar xJf - -C /opt/node --strip-components=1 \ + && curl -sSL https://nodejs.org/download/release/v20.14.0/node-v20.14.0-${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 /go/src/github.com/hyperledger/fabric/build/bin/* /usr/local/bin/ -COPY --from=builder /go/src/github.com/hyperledger/fabric-ca/release/build/bin/* /usr/local/bin/ +COPY --from=builder /tmp/go/src/github.com/hyperledger/fabric/build/bin/* /usr/local/bin/ +COPY --from=builder /tmp/go/src/github.com/hyperledger/fabric-ca/release/build/bin/* /usr/local/bin/ COPY --from=builder /fabric/config /etc/hyperledger/fabric -COPY --from=builder /go/src/github.com/IBM/microfab/microfabd /usr/local/bin/ +COPY --from=builder /tmp/go/src/github.com/IBM/microfab/microfabd /usr/local/bin/ -COPY --from=builder --chown=microfab:microfab /go/src/github.com/IBM/microfab/builders/ /home/microfab/builders/ -COPY --from=builder --chown=microfab:microfab /go/src/github.com/hyperledger/fabric/release/*/builders/ccaas /home/microfab/builders/ccaas +COPY --from=builder --chown=microfab:microfab /tmp/go/src/github.com/IBM/microfab/builders/ /home/microfab/builders/ +COPY --from=builder --chown=microfab:microfab /tmp/go/src/github.com/hyperledger/fabric/release/*/builders/ccaas /home/microfab/builders/ccaas RUN sed -i 's/opt/home/g' /opt/couchdb/etc/local.d/local.ini @@ -98,8 +99,8 @@ RUN curl -sSL -o /tmp/gradle.zip https://services.gradle.org/distributions/gradl && rm -f /tmp/gradle.zip \ && rm -rf /opt/gradle-5.6.4 \ && cd - \ - && curl -sSL https://downloads.apache.org/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz | tar xzf - -C /opt \ - && mv /opt/apache-maven-3.6.3 /opt/maven + && curl -sSL https://dlcdn.apache.org/maven/maven-3/3.9.7/binaries/apache-maven-3.9.7-bin.tar.gz | tar xzf - -C /opt \ + && mv /opt/apache-maven-3.9.7 /opt/maven ENV PATH=/opt/gradle/bin:/opt/maven/bin:${PATH} ADD builders/java/pom.xml /opt/fabric-chaincode-java/ @@ -119,4 +120,4 @@ ENV GOENV=/tmp/goenv ENV GOPATH=/tmp/go VOLUME /home/microfab/data -ENTRYPOINT [ "tini", "--", "/usr/local/bin/docker-entrypoint.sh" ] +ENTRYPOINT [ "tini", "--", "/usr/local/bin/docker-entrypoint.sh" ] \ No newline at end of file