diff --git a/Dockerfile b/Dockerfile index 7a89b4e027..5adc499de6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 @@ -20,7 +28,8 @@ 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 @@ -28,7 +37,7 @@ 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/ diff --git a/Makefile b/Makefile index d66ed469aa..4d8c7924c2 100644 --- a/Makefile +++ b/Makefile @@ -89,3 +89,5 @@ swagger: $(VGO) test ./internal/apiserver -timeout=10s -tags swagger manifest: ./manifestgen.sh +docker: + ./docker_build.sh \ No newline at end of file diff --git a/docker_build.sh b/docker_build.sh new file mode 100755 index 0000000000..42e5de8c28 --- /dev/null +++ b/docker_build.sh @@ -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 \ + . \ No newline at end of file diff --git a/manifest.json b/manifest.json index c664f8b2f1..7e493f394d 100644 --- a/manifest.json +++ b/manifest.json @@ -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", @@ -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" } } diff --git a/manifestgen.sh b/manifestgen.sh index 5f253f6199..36d7db9c46 100755 --- a/manifestgen.sh +++ b/manifestgen.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright © 2021 Kaleido, Inc. +# Copyright © 2022 Kaleido, Inc. # # SPDX-License-Identifier: Apache-2.0 # @@ -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 @@ -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=( @@ -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 \ No newline at end of file diff --git a/smart_contracts/ethereum/solidity_firefly/package.json b/smart_contracts/ethereum/solidity_firefly/package.json index 853631d844..c1abf53ab4 100644 --- a/smart_contracts/ethereum/solidity_firefly/package.json +++ b/smart_contracts/ethereum/solidity_firefly/package.json @@ -2,6 +2,6 @@ "name": "@hyperledger/assettrail-contracts", "version": "0.0.1", "dependencies": { - "truffle": "^5.4.26" + "truffle": "^5.4.32" } } diff --git a/smart_contracts/ethereum/solidity_firefly/truffle-config.js b/smart_contracts/ethereum/solidity_firefly/truffle-config.js index e2ab3841b6..b388c81f32 100644 --- a/smart_contracts/ethereum/solidity_firefly/truffle-config.js +++ b/smart_contracts/ethereum/solidity_firefly/truffle-config.js @@ -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" } } diff --git a/test/e2e/run.sh b/test/e2e/run.sh index 321827ec79..54ecf5d0bc 100755 --- a/test/e2e/run.sh +++ b/test/e2e/run.sh @@ -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() { @@ -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