Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
FROM golang:1.16-alpine3.13 AS firefly-builder
ARG FIREFLY_BUILDER_TAG
ARG FABRIC_BUILDER_TAG
ARG FABRIC_BUILDER_PLATFORM
ARG SOLIDITY_BUILDER_TAG
ARG BASE_TAG

FROM $FIREFLY_BUILDER_TAG AS firefly-builder
ARG UI_TAG
ARG UI_RELEASE
RUN apk add make gcc build-base curl git
WORKDIR /firefly
ADD go.mod go.sum ./
RUN go mod download
ENV UI_RELEASE "https://github.com/hyperledger/firefly-ui/releases/download/v0.5.0/v0.5.0_8cb358c.tgz"
ENV UI_RELEASE https://github.com/hyperledger/firefly-ui/releases/download/$UI_TAG/$UI_RELEASE.tgz
RUN mkdir /firefly/frontend \
&& curl -sLo - $UI_RELEASE | tar -C /firefly/frontend -zxvf -
ADD . .
RUN make build

FROM golang:1.16-alpine3.13 AS fabric-builder
RUN apk add libc6-compat
FROM --platform=$FABRIC_BUILDER_PLATFORM $FABRIC_BUILDER_TAG AS fabric-builder
RUN apk add libc6-compat
WORKDIR /firefly/smart_contracts/fabric/firefly-go
ADD smart_contracts/fabric/firefly-go .
RUN GO111MODULE=on go mod vendor
Expand All @@ -20,15 +28,16 @@ RUN tar -zxf hyperledger-fabric-linux-amd64-2.3.2.tar.gz
RUN touch core.yaml
RUN ./bin/peer lifecycle chaincode package /firefly/smart_contracts/fabric/firefly-go/firefly_fabric.tar.gz --path /firefly/smart_contracts/fabric/firefly-go --lang golang --label firefly_1.0

FROM node:14-alpine3.11 AS solidity-builder
FROM $SOLIDITY_BUILDER_TAG AS solidity-builder
RUN apk add python3 make gcc g++ musl-dev
WORKDIR /firefly/solidity_firefly
ADD smart_contracts/ethereum/solidity_firefly/package*.json .
RUN npm install
RUN npm config set user 0
ADD smart_contracts/ethereum/solidity_firefly .
RUN npx truffle compile

FROM alpine:latest
FROM $BASE_TAG
WORKDIR /firefly
COPY --from=firefly-builder /firefly/firefly ./firefly
COPY --from=firefly-builder /firefly/frontend/ /firefly/frontend/
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,5 @@ swagger:
$(VGO) test ./internal/apiserver -timeout=10s -tags swagger
manifest:
./manifestgen.sh
docker:
./docker_build.sh
47 changes: 47 additions & 0 deletions docker_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash

# Copyright © 2022 Kaleido, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


if [[ ! -x `which jq` ]]; then echo "Please install \"jq\" to continue"; exit 1; fi

FIREFLY_BUILDER_TAG=$(cat manifest.json | jq -r '.build."firefly-builder".image')
FABRIC_BUILDER_TAG=$(cat manifest.json | jq -r '.build."fabric-builder".image')
FABRIC_BUILDER_PLATFORM=$(cat manifest.json | jq -r '.build."fabric-builder".platform')
SOLIDITY_BUILDER_TAG=$(cat manifest.json | jq -r '.build."solidity-builder".image')
BASE_TAG=$(cat manifest.json | jq -r '.build.base.image')
UI_TAG=$(cat manifest.json | jq -r '.ui.tag')
UI_RELEASE=$(cat manifest.json | jq -r '.ui.release')

echo FIREFLY_BUILDER_TAG=$FIREFLY_BUILDER_TAG
echo FABRIC_BUILDER_TAG=$FABRIC_BUILDER_TAG
echo FABRIC_BUILDER_PLATFORM=$FABRIC_BUILDER_PLATFORM
echo SOLIDITY_BUILDER_TAG=$SOLIDITY_BUILDER_TAG
echo BASE_TAG=$BASE_TAG
echo UI_TAG=$UI_TAG
echo UI_RELEASE=$UI_RELEASE

docker build \
-t hyperledger/firefly \
--build-arg FIREFLY_BUILDER_TAG=$FIREFLY_BUILDER_TAG \
--build-arg FABRIC_BUILDER_TAG=$FABRIC_BUILDER_TAG \
--build-arg FABRIC_BUILDER_PLATFORM=$FABRIC_BUILDER_PLATFORM \
--build-arg SOLIDITY_BUILDER_TAG=$SOLIDITY_BUILDER_TAG \
--build-arg BASE_TAG=$BASE_TAG \
--build-arg UI_TAG=$UI_TAG \
--build-arg UI_RELEASE=$UI_RELEASE \
.
30 changes: 26 additions & 4 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
},
"fabconnect": {
"image": "ghcr.io/hyperledger/firefly-fabconnect",
"tag": "v0.9.7",
"sha": "4b1bf26343ae90d6bdba12e1f3ae0eb95e31109b487233263ff0e5233dda5843"
"tag": "v0.9.8",
"sha": "e5d5775cfa6872ee55e9743072d5c8429ce6330312e863965855db7797860b56"
},
"dataexchange-https": {
"image": "ghcr.io/hyperledger/firefly-dataexchange-https",
Expand All @@ -21,7 +21,29 @@
},
"tokens-erc20-erc721": {
"image": "ghcr.io/hyperledger/firefly-tokens-erc20-erc721",
"tag": "v0.1.4",
"sha": "6de65db8dfe322e6244bbd787c10406007a88049d749b5045065163c66d612eb"
"tag": "v0.1.5",
"sha": "dbd7b2c81ec80b6158eaa66e84e3dc635d1f5c31e8296270eab66fd5bbc0afc6"
},
"build": {
"firefly-builder": {
"image": "golang:1.16-alpine3.15"
},
"fabric-builder": {
"image": "golang:1.16-alpine3.15",
"platform": "linux/x86_64"
},
"solidity-builder": {
"image": "node:14-alpine3.15"
},
"base": {
"image": "alpine:3.15"
}
},
"ui": {
"tag": "v0.5.0",
"release": "v0.5.0_8cb358c"
},
"cli": {
"tag": "v0.0.43"
}
}
22 changes: 15 additions & 7 deletions manifestgen.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Copyright © 2021 Kaleido, Inc.
# Copyright © 2022 Kaleido, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
Expand All @@ -19,6 +19,8 @@
# This script will automatically update the manifest.json file with the
# latest releases of all FireFly microservice dependencies

if [[ ! -x `which jq` ]]; then echo "Please install \"jq\" to continue"; exit 1; fi

USE_HEAD=false

# If you pass the string "head" as an argument to this script, it will
Expand All @@ -31,6 +33,12 @@ if [[ $# -eq 1 ]] ; then
fi
fi

# These sections are currently not pulled from GitHub automatically
# so these sections are copied over from the existing file
BUILD_SECTION=$(cat manifest.json | jq .build)
UI_SECTION=$(cat manifest.json | jq .ui)
CLI_SECTION=$(cat manifest.json | jq .cli)

rm -f manifest.json

SERVICES=(
Expand Down Expand Up @@ -72,12 +80,12 @@ do

echo " \"tag\": \"$TAG_LABEL\"," >> manifest.json
echo " \"sha\": \"$SHA\"" >> manifest.json
if [[ $(($i + 1)) -eq ${SERVICE_COUNT} ]]
then
echo " }" >> manifest.json
else
echo " }," >> manifest.json
fi
echo " }," >> manifest.json
done

# Add the build and UI sections, piping to sed to get proper indentation
echo "\"build\": $BUILD_SECTION," | sed 's/^/ /' >> manifest.json
echo "\"ui\": $UI_SECTION," | sed 's/^/ /' >> manifest.json
echo "\"cli\": $CLI_SECTION" | sed 's/^/ /' >> manifest.json

echo "}" >> manifest.json
2 changes: 1 addition & 1 deletion smart_contracts/ethereum/solidity_firefly/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"name": "@hyperledger/assettrail-contracts",
"version": "0.0.1",
"dependencies": {
"truffle": "^5.4.26"
"truffle": "^5.4.32"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = {
},
compilers: {
solc: {
version: "^0.7.0", // Fetch exact version from solc-bin (default: truffle's version)
version: "^0.8.0", // Fetch exact version from solc-bin (default: truffle's version)
evmVersion: "constantinople"
}
}
Expand Down
9 changes: 6 additions & 3 deletions test/e2e/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@

set -o pipefail

if [[ ! -x `which jq` ]]; then echo "Please install \"jq\" to continue"; exit 1; fi

CWD=$(dirname "$0")
CLI="ff -v --ansi never"
CLI_VERSION=$(cat $CWD/../../manifest.json | jq -r .cli.tag)
STACK_DIR=~/.firefly/stacks

checkOk() {
Expand Down Expand Up @@ -65,17 +68,17 @@ if [ "$CREATE_STACK" == "true" ]; then
fi

if [ "$BUILD_FIREFLY" == "true" ]; then
docker build -t hyperledger/firefly ../..
make -C ../.. docker
checkOk $?
fi

if [ "$DOWNLOAD_CLI" == "true" ]; then
go install github.com/hyperledger/firefly-cli/ff@v0.0.41
go install github.com/hyperledger/firefly-cli/ff@$CLI_VERSION
checkOk $?
fi

if [ "$CREATE_STACK" == "true" ]; then
$CLI init --prometheus-enabled --database $DATABASE_TYPE $STACK_NAME 2 --blockchain-provider $BLOCKCHAIN_PROVIDER --tokens-provider $TOKENS_PROVIDER --manifest ../../manifest.json
$CLI init --prometheus-enabled --database $DATABASE_TYPE $STACK_NAME 2 --blockchain-provider $BLOCKCHAIN_PROVIDER --token-providers $TOKENS_PROVIDER --manifest ../../manifest.json
checkOk $?

$CLI pull $STACK_NAME -r 3
Expand Down