Commit ba3f2a11 authored by Alexader's avatar Alexader

feat(Dockerfile): add dockerfile to build pier with fabric plugin

parent 944d7092
FROM golang:1.14.2 as builder
RUN mkdir -p /go/src/github.com/meshplus/pier
RUN mkdir -p /go/src/github.com/meshplus/pier-client-fabric
WORKDIR /go/src/github.com/meshplus/pier
# Cache dependencies
COPY go.mod ../pier-client-fabric/
COPY go.sum ../pier-client-fabric/
COPY build/pier/go.mod .
COPY build/pier/go.sum .
RUN go env -w GOPROXY=https://goproxy.cn,direct
RUN go mod download -x
#RUN apk add make
# Build real binaries
COPY build/pier .
COPY . ../pier-client-fabric/
RUN go get -u github.com/gobuffalo/packr/packr
RUN make install
RUN cd ../pier-client-fabric && \
make fabric1.4 && \
cp build/fabric-client-1.4.so /go/bin/fabric-client-1.4.so
# Final image
FROM frolvlad/alpine-glibc
WORKDIR /root
# Copy over binaries from the builder
COPY --from=builder /go/bin/pier /usr/local/bin
COPY ./build/pier/build/libwasmer.so /lib
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/lib
RUN ["pier", "init"]
RUN mkdir -p /root/.pier/plugins
COPY --from=builder /go/bin/*.so /root/.pier/plugins/
COPY config/validating.wasm /root/.pier/validating.wasm
COPY scripts/docker_entrypoint.sh /root/docker_entrypoint.sh
RUN chmod +x /root/docker_entrypoint.sh
COPY config /root/.pier/fabric
COPY config/pier.toml /root/.pier/pier.toml
ENV APPCHAIN_NAME=fabric
EXPOSE 44555 44544
# run pier inside container using:
# docker run -t --env APPCHAIN_NAME=ether \
# -v your/path/to/rule:/root/.pier/validating.wasm \
# -v your/path/to/pier.toml:/root/.pier/pier.toml \
# -v your/path/to/plugin_config:/root/.pier/ether \
# pier-fabric
ENTRYPOINT ["/root/docker_entrypoint.sh", "$APPCHAIN_NAME"]
......@@ -20,10 +20,15 @@ fabric1.4:
mkdir -p build
$(GO) build --buildmode=plugin -o build/fabric-client-1.4.so ./*.go
docker:
mkdir -p build
cd build && rm -rf pier && cp -r ../../pier pier
cd ${CURRENT_PATH}
docker build -t pier-fabric .
fabric1.4-linux:
cd scripts && sh cross_compile.sh linux-amd64 ${CURRENT_PATH}
## make linter: Run golanci-lint
linter:
golangci-lint run
......@@ -125,7 +125,7 @@ organizations:
#
orderers:
orderer.example.com:
url: grpcs://10.1.16.48:7050
url: grpcs://host.docker.internal:7050
# these are standard properties defined by the gRPC library
# they will be passed in as-is to gRPC client constructor
......@@ -152,8 +152,8 @@ orderers:
peers:
peer0.org1.example.com:
# this URL is used to send endorsement and query requests
url: grpcs://10.1.16.48:7051
eventUrl: grpcs://10.1.16.48:7053
url: grpcs://host.docker.internal:7051
eventUrl: grpcs://host.docker.internal:7053
grpcOptions:
ssl-target-name-override: peer0.org1.example.com
# These parameters should be set in coordination with the keepalive policy on the server,
......@@ -172,8 +172,8 @@ peers:
peer1.org1.example.com:
# this URL is used to send endorsement and query requests
url: grpcs://10.1.16.48:8051
eventUrl: grpcs://10.1.16.48:8053
url: grpcs://host.docker.internal:8051
eventUrl: grpcs://host.docker.internal:8053
grpcOptions:
ssl-target-name-override: peer1.org1.example.com
# These parameters should be set in coordination with the keepalive policy on the server,
......@@ -192,8 +192,8 @@ peers:
peer0.org2.example.com:
# this URL is used to send endorsement and query requests
url: grpcs://10.1.16.48:9051
eventUrl: grpcs://10.1.16.48:9053
url: grpcs://host.docker.internal:9051
eventUrl: grpcs://host.docker.internal:9053
grpcOptions:
ssl-target-name-override: peer0.org2.example.com
# These parameters should be set in coordination with the keepalive policy on the server,
......@@ -212,8 +212,8 @@ peers:
peer1.org2.example.com:
# this URL is used to send endorsement and query requests
url: grpcs://10.1.16.48:10051
eventUrl: grpcs://10.1.16.48:10053
url: grpcs://host.docker.internal:10051
eventUrl: grpcs://host.docker.internal:10053
grpcOptions:
ssl-target-name-override: peer1.org2.example.com
# These parameters should be set in coordination with the keepalive policy on the server,
......@@ -270,27 +270,27 @@ peers:
entityMatchers:
peer:
- pattern: (\w*)peer0.org1.example.com:(\w*)
urlSubstitutionExp: grpcs://10.1.16.48:7051
eventUrlSubstitutionExp: grpcs://10.1.16.48:7053
urlSubstitutionExp: grpcs://host.docker.internal:7051
eventUrlSubstitutionExp: grpcs://host.docker.internal:7053
sslTargetOverrideUrlSubstitutionExp: peer0.org1.example.com
mappedHost: peer0.org1.example.com
- pattern: (\w*)peer1.org1.example.com:(\w*)
urlSubstitutionExp: grpcs://10.1.16.48:8051
eventUrlSubstitutionExp: grpcs://10.1.16.48:8053
urlSubstitutionExp: grpcs://host.docker.internal:8051
eventUrlSubstitutionExp: grpcs://host.docker.internal:8053
sslTargetOverrideUrlSubstitutionExp: peer1.org1.example.com
mappedHost: peer1.org1.example.com
- pattern: (\w*)peer0.org2.example.com:(\w*)
urlSubstitutionExp: grpcs://10.1.16.48:9051
eventUrlSubstitutionExp: grpcs://10.1.16.48:9053
urlSubstitutionExp: grpcs://host.docker.internal:9051
eventUrlSubstitutionExp: grpcs://host.docker.internal:9053
sslTargetOverrideUrlSubstitutionExp: peer0.org2.example.com
mappedHost: peer0.org2.example.com
- pattern: (\w*)peer1.org2.example.com:(\w*)
urlSubstitutionExp: grpcs://10.1.16.48:10051
eventUrlSubstitutionExp: grpcs://10.1.16.48:10053
urlSubstitutionExp: grpcs://host.docker.internal:10051
eventUrlSubstitutionExp: grpcs://host.docker.internal:10053
sslTargetOverrideUrlSubstitutionExp: peer1.org2.example.com
mappedHost: peer1.org2.example.com
......@@ -323,6 +323,6 @@ entityMatchers:
#entityMatchers:
orderer:
- pattern: (\w*)orderer.example.com(\w*)
urlSubstitutionExp: grpcs://10.1.16.48:7050
urlSubstitutionExp: grpcs://host.docker.internal:7050
sslTargetOverrideUrlSubstitutionExp: orderer.example.com
mappedHost: orderer.example.com
addr = "localhost:7053"
addr = "host.docker.internal:7053"
event_filter = "interchain-event-name"
username = "Admin"
ccid = "broker"
......
title = "Pier"
[port]
http = 44544
pprof = 44555
[log]
level = "debug"
dir = "logs"
filename = "pier.log"
report_caller = false
[mode]
type = "relay" # relay or direct
[mode.relay]
addr = "host.docker.internal:60011"
quorum = 2
validators = [
"0x000f1a7a08ccc48e5d30f80850cf1cf283aa3abd",
"0xe93b92f1da08f925bdee44e91e7768380ae83307",
"0xb18c8575e3284e79b92100025a31378feb8100d6",
"0x856E2B9A5FA82FD1B031D1FF6863864DBAC7995D",
]
[mode.direct]
peers = [
#"/ip4/host.docker.internal/tcp/4002/p2p/Qmf4fn6sT3yLh3uqJnJ453yAhzpccbCQ75XfnBURTD3NoR",
"/ip4/host.docker.internal/tcp/4003/p2p/QmS78YUNXbxjaKivSygyDkxjZXedYy4TF6vfAJRPMRYdZ8",
"/ip4/host.docker.internal/tcp/4004/p2p/QmZpeCcBQBaurf8SUEvxjRY1nLYAHHUzqWLEXd4uoiuE9K"
]
[appchain]
plugin = "fabric-client-1.4.so"
config = "fabric"
......@@ -23,7 +23,7 @@ require (
replace github.com/golang/protobuf => github.com/golang/protobuf v1.3.2
replace google.golang.org/grpc => google.golang.org/grpc v1.28.1
replace google.golang.org/grpc => google.golang.org/grpc v1.27.1
replace gopkg.in/yaml.v2 => gopkg.in/yaml.v2 v2.2.7
......@@ -33,6 +33,8 @@ replace github.com/meshplus/pier => ../pier
replace golang.org/x/text => golang.org/x/text v0.3.0
replace golang.org/x/sys => golang.org/x/sys v0.0.0-20200509044756-6aff5f38e54f
replace github.com/spf13/afero => github.com/spf13/afero v1.1.2
replace github.com/spf13/pflag => github.com/spf13/pflag v1.0.5
......
#!/usr/bin/env sh
set -e
APPCHAIN_NAME=$1
pier --repo=/root/.pier appchain register --name=${APPCHAIN_NAME} --type=fabric --validators=/root/.pier/fabric/fabric.validators --desc="appchain for test" --version=1.4.3
pier --repo=/root/.pier rule deploy --path=/root/.pier/validating.wasm
pier --repo=/root/.pier start
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment