forked from hyperledger-labs/microfab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile2
122 lines (95 loc) · 5.04 KB
/
Dockerfile2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#
# SPDX-License-Identifier: Apache-2.0
#
FROM golang:1.18 AS builder
ENV DEBIAN_FRONTEND=noninteractive
# 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
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
WORKDIR $GOPATH/src/github.com/hyperledger/fabric
ENV CGO_ENABLED=0
RUN make orderer \
&& make tools \
&& make ccaasbuilder
WORKDIR $GOPATH/src/github.com/hyperledger/fabric-ca
ENV CGO_ENABLED=1
RUN make release/build/bin/fabric-ca-client \
&& make release/build/bin/fabric-ca-server
WORKDIR $GOPATH/src/github.com/IBM/microfab
ENV CGO_ENABLED=0
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
FROM couchdb:3.1.2
# 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\
&& rm -rf /var/lib/apt/lists/*
RUN groupadd -g 7051 microfab \
&& useradd -u 7051 -g microfab -G root -s /bin/bash -m 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
# 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 \
; 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 \
; 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 /fabric/config /etc/hyperledger/fabric
COPY --from=builder /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
RUN sed -i 's/opt/home/g' /opt/couchdb/etc/local.d/local.ini
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-5.6.4-bin.zip \
&& unzip -qq /tmp/gradle.zip -d /opt \
&& mkdir -p /opt/gradle/bin \
&& cd /opt/gradle/bin \
&& /opt/gradle-5.6.4/bin/gradle wrapper \
&& 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
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.4.2 \
&& rm -rf /tmp/gocache /tmp/goenv /tmp/go /tmp/maven /tmp/npm-cache /tmp/npm-devdir
RUN chmod 666 /etc/passwd
EXPOSE 8080
USER 7051
ENV GOROOT=/opt/go
ENV GOCACHE=/tmp/gocache
ENV GOENV=/tmp/goenv
ENV GOPATH=/tmp/go
VOLUME /home/microfab/data
ENTRYPOINT [ "tini", "--", "/usr/local/bin/docker-entrypoint.sh" ]