Speed up e2e building process (#395)

This commit is contained in:
Kirill Fedoseev 2020-07-14 21:53:05 +07:00 committed by GitHub
parent 42953ffe30
commit ebd97dce5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 280 additions and 131 deletions

@ -36,20 +36,6 @@ orbs:
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get -y install yarn
yarn-install-cached-on-machine:
steps:
- restore_cache:
name: Restore Machine Yarn Package Cache
keys:
- yarn-machine-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}
- run:
name: Install npm dependencies using Yarn
command: nvm use default; yarn install --frozen-lockfile
- save_cache:
name: Save Machine Yarn Package Cache
key: yarn-machine-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}
paths:
- ~/.cache/yarn
wait-for-oracle:
parameters:
redis-key:
@ -73,21 +59,30 @@ orbs:
echo "Sleeping..."
sleep 3
done
init-repo:
steps:
- checkout
- run: git submodule update --init
executors:
docker-node:
docker:
- image: circleci/node:10.15
machine-with-docker-caching:
machine-with-dlc:
machine:
image: ubuntu-1604:202007-01
docker_layer_caching: true
classic-machine-without-dlc:
machine:
image: circleci/classic:latest
docker_layer_caching: true
machine-without-dlc:
machine:
image: ubuntu-1604:202007-01
jobs:
initialize:
executor: tokenbridge-orb/docker-node
steps:
- checkout
- run: git submodule update --init
- tokenbridge-orb/init-repo
- restore_cache:
name: Restore Yarn Package Cache
keys:
@ -140,29 +135,34 @@ jobs:
- restore_cache:
key: initialize-{{ .Environment.CIRCLE_SHA1 }}
- run: yarn run test
build-e2e-images:
executor: tokenbridge-orb/machine-without-dlc
steps:
- tokenbridge-orb/init-repo
- run:
command: |
docker login -u ${DOCKER_LOGIN} -p ${DOCKER_PASSWORD}
cd e2e-commons
docker-compose build oracle monitor ui e2e molecule_runner
docker-compose push oracle monitor ui e2e molecule_runner
oracle-e2e:
executor: tokenbridge-orb/docker-node
executor: tokenbridge-orb/machine-without-dlc
steps:
- checkout
- run: git submodule update --init
- setup_remote_docker:
docker_layer_caching: true
- run: yarn run oracle-e2e
- tokenbridge-orb/init-repo
- run: ./oracle-e2e/run-tests.sh
ui-e2e:
executor: tokenbridge-orb/machine-with-docker-caching
executor: tokenbridge-orb/machine-without-dlc
steps:
- checkout
- tokenbridge-orb/install-node
- tokenbridge-orb/install-yarn
- tokenbridge-orb/install-chrome
- run: git submodule update --init
- tokenbridge-orb/yarn-install-cached-on-machine
- restore_cache:
key: initialize-{{ .Environment.CIRCLE_SHA1 }}
- run: yarn run ui-e2e
monitor-e2e:
executor: tokenbridge-orb/machine-with-docker-caching
executor: tokenbridge-orb/machine-without-dlc
steps:
- checkout
- run: git submodule update --init
- tokenbridge-orb/init-repo
- run: ./monitor-e2e/run-tests.sh
cover:
executor: tokenbridge-orb/docker-node
@ -172,55 +172,47 @@ jobs:
- run: yarn workspace ui run coverage
- run: yarn workspace ui run coveralls
deployment-oracle:
executor: tokenbridge-orb/machine-with-docker-caching
executor: tokenbridge-orb/machine-without-dlc
steps:
- checkout
- run: git submodule update --init
- tokenbridge-orb/init-repo
- run:
name: Run the scenario
command: deployment-e2e/molecule.sh oracle
no_output_timeout: 40m
deployment-ui:
executor: tokenbridge-orb/machine-with-docker-caching
executor: tokenbridge-orb/machine-without-dlc
steps:
- checkout
- run: git submodule update --init
- tokenbridge-orb/init-repo
- run:
name: Run the scenario
command: deployment-e2e/molecule.sh ui
no_output_timeout: 40m
deployment-monitor:
executor: tokenbridge-orb/machine-with-docker-caching
executor: tokenbridge-orb/machine-without-dlc
steps:
- checkout
- run: git submodule update --init
- tokenbridge-orb/init-repo
- run:
name: Run the scenario
command: deployment-e2e/molecule.sh monitor
no_output_timeout: 40m
deployment-repo:
executor: tokenbridge-orb/machine-with-docker-caching
executor: tokenbridge-orb/machine-without-dlc
steps:
- checkout
- run: git submodule update --init
- tokenbridge-orb/install-node
- tokenbridge-orb/install-yarn
- tokenbridge-orb/yarn-install-cached-on-machine
- tokenbridge-orb/init-repo
- run:
name: Run the scenario
command: deployment-e2e/molecule.sh repo
no_output_timeout: 40m
deployment-multiple:
executor: tokenbridge-orb/machine-with-docker-caching
executor: tokenbridge-orb/machine-without-dlc
steps:
- checkout
- run: git submodule update --init
- tokenbridge-orb/init-repo
- run:
name: Run the scenario
command: deployment-e2e/molecule.sh multiple
no_output_timeout: 40m
ultimate:
executor: tokenbridge-orb/machine-with-docker-caching
executor: tokenbridge-orb/classic-machine-without-dlc
parameters:
scenario-name:
description: "Molecule scenario name used to create the infrastructure"
@ -237,12 +229,11 @@ jobs:
default: ''
type: string
steps:
- checkout
- run: git submodule update --init
- tokenbridge-orb/install-node
- tokenbridge-orb/install-chrome
- tokenbridge-orb/install-yarn
- tokenbridge-orb/yarn-install-cached-on-machine
- restore_cache:
key: initialize-{{ .Environment.CIRCLE_SHA1 }}
- run:
name: Prepare the infrastructure
command: e2e-commons/up.sh deploy << parameters.scenario-name >> blocks
@ -286,35 +277,93 @@ workflows:
filters:
branches:
only: master
- oracle-e2e
- ui-e2e
- monitor-e2e
- deployment-oracle
- deployment-ui
- deployment-monitor
- deployment-repo
- deployment-multiple
- build-e2e-images
- oracle-e2e:
requires:
- build-e2e-images
- ui-e2e:
requires:
- build-e2e-images
- initialize
- monitor-e2e:
requires:
- build-e2e-images
- deployment-oracle:
requires:
- build-e2e-images
- deployment-ui:
requires:
- build-e2e-images
- deployment-monitor:
requires:
- build-e2e-images
- deployment-repo:
requires:
- build-e2e-images
- deployment-multiple:
requires:
- build-e2e-images
- ultimate:
requires:
- build-e2e-images
- initialize
filters:
branches:
only:
- master
- develop
name: "ultimate: native to erc"
scenario-name: native-to-erc
redis-key: native-erc-collected-signatures:lastProcessedBlock
ui-e2e-grep: "NATIVE TO ERC"
- ultimate:
requires:
- build-e2e-images
- initialize
filters:
branches:
only:
- master
- develop
name: "ultimate: erc to native"
scenario-name: erc-to-native
redis-key: erc-native-collected-signatures:lastProcessedBlock
ui-e2e-grep: "ERC TO NATIVE"
- ultimate:
requires:
- build-e2e-images
- initialize
filters:
branches:
only:
- master
- develop
name: "ultimate: erc to erc"
scenario-name: erc-to-erc
redis-key: erc-erc-collected-signatures:lastProcessedBlock
ui-e2e-grep: "ERC TO ERC"
- ultimate:
requires:
- build-e2e-images
- initialize
filters:
branches:
only:
- master
- develop
name: "ultimate: amb"
scenario-name: amb
redis-key: amb-collected-signatures:lastProcessedBlock
oracle-e2e-script: "amb"
- ultimate:
requires:
- build-e2e-images
- initialize
filters:
branches:
only:
- master
- develop
name: "ultimate: amb stake erc to erc"
scenario-name: ultimate-amb-stake-erc-to-erc
redis-key: amb-collected-signatures:lastProcessedBlock

@ -1,15 +1,31 @@
FROM node:10
FROM node:8 as contracts
WORKDIR /mono
COPY contracts/package.json contracts/package-lock.json ./contracts/
WORKDIR /mono/contracts
RUN npm install --only=prod
COPY ./contracts/truffle-config.js ./
COPY ./contracts/contracts ./contracts
RUN npm run compile
FROM node:8
WORKDIR /mono
COPY package.json .
COPY --from=contracts /mono/contracts/build ./contracts/build
COPY oracle-e2e/package.json ./oracle-e2e/
COPY monitor-e2e/package.json ./monitor-e2e/
COPY contracts/package.json ./contracts/
COPY yarn.lock .
RUN yarn install --frozen-lockfile
COPY ./contracts ./contracts
RUN yarn install:deploy
RUN yarn compile:contracts
RUN NOYARNPOSTINSTALL=1 yarn install --frozen-lockfile --production
COPY . .
COPY ./contracts/deploy ./contracts/deploy
RUN yarn install:deploy
COPY commons/ ./commons/
COPY oracle-e2e/ ./oracle-e2e/
COPY monitor-e2e/ ./monitor-e2e/
COPY e2e-commons/ ./e2e-commons/

@ -1,20 +1,29 @@
FROM node:8 as contracts
WORKDIR /mono
COPY contracts/package.json contracts/package-lock.json ./contracts/
WORKDIR /mono/contracts
RUN npm install --only=prod
COPY ./contracts/truffle-config.js ./
COPY ./contracts/contracts ./contracts
RUN npm run compile
FROM node:12 as alm-builder
WORKDIR /mono
COPY package.json .
COPY contracts/package.json ./contracts/
COPY --from=contracts /mono/contracts/build ./contracts/build
COPY commons/package.json ./commons/
COPY alm/package.json ./alm/
COPY yarn.lock .
RUN yarn install --production --frozen-lockfile
COPY ./contracts ./contracts
RUN yarn run compile:contracts
RUN mv ./contracts/build ./ && rm -rf ./contracts/* ./contracts/.[!.]* && mv ./build ./contracts/
RUN NOYARNPOSTINSTALL=1 yarn install --frozen-lockfile --production
COPY ./commons ./commons
COPY ./alm ./alm
ARG DOT_ENV_PATH=./alm/.env
COPY ${DOT_ENV_PATH} ./alm/.env

@ -1,12 +0,0 @@
---
version: '3.0'
services:
molecule_runner:
build:
context: ..
dockerfile: deployment-e2e/Dockerfile
restart: 'no'
privileged: true
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ..:/mono

@ -1,9 +1,11 @@
#!/usr/bin/env bash
cd $(dirname $0)
cd ./e2e-commons
set -e # exit when any command fails
docker-compose pull molecule_runner
docker network create --driver bridge ultimate || true
while [ "$1" != "" ]; do
docker-compose build && docker-compose run molecule_runner /bin/bash -c "molecule test --scenario-name $1"
docker-compose run molecule_runner /bin/bash -c "molecule test --scenario-name $1"
shift # Shift all the parameters down by one
done

@ -0,0 +1,7 @@
ARG DOCKER_LOGIN
ARG CIRCLE_BRANCH
FROM ${DOCKER_LOGIN}/tokenbridge-e2e-ui:${CIRCLE_BRANCH}
ARG DOT_ENV_PATH
COPY ${DOT_ENV_PATH} ./.env

@ -22,9 +22,16 @@ Shut down and cleans up containers, networks, services, running scripts:
| --- | --- |
| deploy | Deploys the Smart Contracts |
| oracle | Launches Oracle containers |
| oracle-validator-2 | Launches Oracle containers for second validator |
| oracle-validator-3 | Launches Oracle containers for third validator |
| ui | Launches UI containers |
| blocks | Auto mines blocks |
| monitor | Launches Monitor containers |
| native-to-erc | Creates infrastructure for ultimate e2e testing, for native-to-erc type of bridge |
| erc-to-native | Creates infrastructure for ultimate e2e testing, for erc-to-native type of bridge |
| erc-to-erc | Creates infrastructure for ultimate e2e testing, for erc-to-erc type of bridge |
| amb | Creates infrastructure for ultimate e2e testing, for arbitrary message type of bridge |
| ultimate-amb-stake-erc-to-erc | Creates infrastructure for ultimate e2e testing, for stake token bridge |
#### Ultimate e2e testing

@ -15,13 +15,13 @@ It runs the e2e tests on components deployed using the deployment playbooks.
Run the Parity nodes, deploy the bridge contracts, deploy Oracle using the deployment playbook.
```bash
./up.sh deploy native-to-erc
./up.sh deploy native-to-erc blocks
```
### 2. Run the E2E tests
```
docker-compose run e2e yarn workspace oracle-e2e run native-to-erc
cd ui-e2e; yarn mocha -g "NATIVE_TO_ERC" -b ./test.js
```
## Diagram

@ -27,6 +27,7 @@ services:
networks:
- ultimate
oracle:
image: ${DOCKER_LOGIN}/tokenbridge-e2e-oracle:${CIRCLE_BRANCH}
build:
context: ..
dockerfile: oracle/Dockerfile
@ -37,6 +38,7 @@ services:
networks:
- ultimate
oracle-erc20:
image: ${DOCKER_LOGIN}/tokenbridge-e2e-oracle:${CIRCLE_BRANCH}
build:
context: ..
dockerfile: oracle/Dockerfile
@ -47,6 +49,7 @@ services:
networks:
- ultimate
oracle-erc20-native:
image: ${DOCKER_LOGIN}/tokenbridge-e2e-oracle:${CIRCLE_BRANCH}
build:
context: ..
dockerfile: oracle/Dockerfile
@ -57,6 +60,7 @@ services:
networks:
- ultimate
oracle-amb:
image: ${DOCKER_LOGIN}/tokenbridge-e2e-oracle:${CIRCLE_BRANCH}
build:
context: ..
dockerfile: oracle/Dockerfile
@ -67,6 +71,7 @@ services:
networks:
- ultimate
ui:
image: ${DOCKER_LOGIN}/tokenbridge-e2e-ui:${CIRCLE_BRANCH}
build:
context: ..
dockerfile: ui/Dockerfile
@ -78,8 +83,10 @@ services:
ui-erc20:
build:
context: ..
dockerfile: ui/Dockerfile
dockerfile: e2e-commons/Dockerfile.ui
args:
DOCKER_LOGIN: ${DOCKER_LOGIN}
CIRCLE_BRANCH: ${CIRCLE_BRANCH}
DOT_ENV_PATH: e2e-commons/components-envs/ui-erc20.env
command: "true"
networks:
@ -87,8 +94,10 @@ services:
ui-erc20-native:
build:
context: ..
dockerfile: ui/Dockerfile
dockerfile: e2e-commons/Dockerfile.ui
args:
DOCKER_LOGIN: ${DOCKER_LOGIN}
CIRCLE_BRANCH: ${CIRCLE_BRANCH}
DOT_ENV_PATH: e2e-commons/components-envs/ui-erc20-native.env
command: "true"
networks:
@ -96,13 +105,16 @@ services:
ui-amb-stake-erc20-erc20:
build:
context: ..
dockerfile: ui/Dockerfile
dockerfile: e2e-commons/Dockerfile.ui
args:
DOCKER_LOGIN: ${DOCKER_LOGIN}
CIRCLE_BRANCH: ${CIRCLE_BRANCH}
DOT_ENV_PATH: e2e-commons/components-envs/ui-amb-stake-erc20-erc20.env
command: "true"
networks:
- ultimate
monitor:
image: ${DOCKER_LOGIN}/tokenbridge-e2e-monitor:${CIRCLE_BRANCH}
build:
context: ..
dockerfile: monitor/Dockerfile
@ -113,6 +125,7 @@ services:
networks:
- ultimate
monitor-erc20:
image: ${DOCKER_LOGIN}/tokenbridge-e2e-monitor:${CIRCLE_BRANCH}
build:
context: ..
dockerfile: monitor/Dockerfile
@ -123,6 +136,7 @@ services:
networks:
- ultimate
monitor-erc20-native:
image: ${DOCKER_LOGIN}/tokenbridge-e2e-monitor:${CIRCLE_BRANCH}
build:
context: ..
dockerfile: monitor/Dockerfile
@ -133,6 +147,7 @@ services:
networks:
- ultimate
monitor-amb:
image: ${DOCKER_LOGIN}/tokenbridge-e2e-monitor:${CIRCLE_BRANCH}
build:
context: ..
dockerfile: monitor/Dockerfile
@ -143,6 +158,7 @@ services:
networks:
- ultimate
e2e:
image: ${DOCKER_LOGIN}/tokenbridge-e2e-e2e:${CIRCLE_BRANCH}
build:
context: ..
dockerfile: Dockerfile.e2e
@ -150,9 +166,20 @@ services:
networks:
- ultimate
blocks:
image: ${DOCKER_LOGIN}/tokenbridge-e2e-e2e:${CIRCLE_BRANCH}
build:
context: ..
dockerfile: Dockerfile.e2e
entrypoint: node e2e-commons/scripts/blocks.js
networks:
- ultimate
molecule_runner:
image: ${DOCKER_LOGIN}/tokenbridge-e2e-molecule_runner:${CIRCLE_BRANCH}
build:
context: ..
dockerfile: deployment-e2e/Dockerfile
restart: 'no'
privileged: true
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ..:/mono

15
e2e-commons/pull.sh Executable file

@ -0,0 +1,15 @@
#!/usr/bin/env bash
cd $(dirname $0)
set -e # exit when any command fails
docker-compose pull e2e
while [ "$1" != "" ]; do
if [ "$1" == "oracle" ]; then
docker-compose pull oracle
elif [ "$1" == "monitor" ]; then
docker-compose pull monitor
elif [ "$1" == "ui" ]; then
docker-compose pull ui
fi
shift
done

@ -23,10 +23,10 @@ function main() {
setTimeout(async () => {
try {
generateNewBlock(homeWeb3, blockGenerator.address)
} catch {} // in case of Transaction with the same hash was already imported.
} catch (_) {} // in case of Transaction with the same hash was already imported.
try {
generateNewBlock(foreignWeb3, blockGenerator.address)
} catch {} // in case of Transaction with the same hash was already imported.
} catch (_) {} // in case of Transaction with the same hash was already imported.
main()
}, 1000)
}

@ -3,14 +3,12 @@ cd $(dirname $0)
set -e # exit when any command fails
./down.sh
docker-compose build
docker-compose build parity1 parity2
test -n "$NODOCKERPULL" || ./pull.sh $@
docker network create --driver bridge ultimate || true
docker-compose up -d parity1 parity2 e2e
startValidator () {
# make sure that old image tags are not cached
docker-compose $1 build
docker-compose $1 run -d --name $4 redis
docker-compose $1 run -d --name $5 rabbit
docker-compose $1 run $2 $3 -d oracle yarn watcher:signature-request
@ -36,7 +34,7 @@ startValidator () {
while [ "$1" != "" ]; do
if [ "$1" == "oracle" ]; then
docker-compose up -d redis rabbit oracle oracle-erc20 oracle-erc20-native oracle-amb
docker-compose up -d redis rabbit
docker-compose run -d oracle yarn watcher:signature-request
docker-compose run -d oracle yarn watcher:collected-signatures
@ -74,6 +72,9 @@ while [ "$1" != "" ]; do
fi
if [ "$1" == "ui" ]; then
# this should only rebuild last 3 steps from ui/Dockerfile
docker-compose build ui-erc20 ui-erc20-native ui-amb-stake-erc20-erc20
docker-compose up -d ui ui-erc20 ui-erc20-native ui-amb-stake-erc20-erc20
docker-compose run -d -p 3000:3000 ui yarn start

@ -9,11 +9,12 @@
},
"author": "",
"license": "ISC",
"dependencies": {},
"dependencies": {
"mocha": "^5.2.0",
"axios": "0.19.0"
},
"engines": {
"node": ">= 8.9"
},
"devDependencies": {
"axios": "0.19.0"
}
"devDependencies": {}
}

@ -1,7 +1,7 @@
while true; do
sleep 3
docker-compose -f ../e2e-commons/docker-compose.yml exec monitor yarn check-all
docker-compose -f ../e2e-commons/docker-compose.yml exec monitor-erc20 yarn check-all
docker-compose -f ../e2e-commons/docker-compose.yml exec monitor-erc20-native yarn check-all
docker-compose -f ../e2e-commons/docker-compose.yml exec monitor-amb yarn check-all
COMPOSE_INTERACTIVE_NO_CLI=1 nohup docker-compose -f ../e2e-commons/docker-compose.yml exec monitor yarn check-all
COMPOSE_INTERACTIVE_NO_CLI=1 nohup docker-compose -f ../e2e-commons/docker-compose.yml exec monitor-erc20 yarn check-all
COMPOSE_INTERACTIVE_NO_CLI=1 nohup docker-compose -f ../e2e-commons/docker-compose.yml exec monitor-erc20-native yarn check-all
COMPOSE_INTERACTIVE_NO_CLI=1 nohup docker-compose -f ../e2e-commons/docker-compose.yml exec monitor-amb yarn check-all
done

@ -1,19 +1,27 @@
FROM node:8 as contracts
WORKDIR /mono
COPY contracts/package.json contracts/package-lock.json ./contracts/
WORKDIR /mono/contracts
RUN npm install --only=prod
COPY ./contracts/truffle-config.js ./
COPY ./contracts/contracts ./contracts
RUN npm run compile
FROM node:8
WORKDIR /mono
COPY package.json .
COPY contracts/package.json ./contracts/
COPY --from=contracts /mono/contracts/build ./contracts/build
COPY commons/package.json ./commons/
COPY monitor/package.json ./monitor/
COPY yarn.lock .
RUN yarn install --frozen-lockfile --production
COPY ./contracts ./contracts
RUN yarn run compile:contracts
RUN mv ./contracts/build ./ && rm -rf ./contracts/* ./contracts/.[!.]* && mv ./build ./contracts/
RUN NOYARNPOSTINSTALL=1 yarn install --frozen-lockfile --production
COPY ./commons ./commons
COPY ./monitor ./monitor
WORKDIR /mono/monitor

@ -11,6 +11,7 @@
"author": "",
"license": "ISC",
"dependencies": {
"mocha": "^5.2.0",
"chalk": "^2.4.1",
"dotenv": "^6.0.0",
"promise-retry": "^1.1.1",

@ -1,3 +1,16 @@
FROM node:8 as contracts
WORKDIR /mono
COPY contracts/package.json contracts/package-lock.json ./contracts/
WORKDIR /mono/contracts
RUN npm install --only=prod
COPY ./contracts/truffle-config.js ./
COPY ./contracts/contracts ./contracts
RUN npm run compile
FROM node:8
RUN apt-get update
@ -9,18 +22,13 @@ RUN apt-get clean
WORKDIR /mono
COPY package.json .
COPY contracts/package.json ./contracts/
COPY --from=contracts /mono/contracts/build ./contracts/build
COPY commons/package.json ./commons/
COPY oracle/package.json ./oracle/
COPY yarn.lock .
RUN yarn install --production --frozen-lockfile
COPY ./contracts ./contracts
RUN yarn run compile:contracts
RUN mv ./contracts/build ./ && rm -rf ./contracts/* ./contracts/.[!.]* && mv ./build ./contracts/
RUN NOYARNPOSTINSTALL=1 yarn install --frozen-lockfile --production
COPY ./commons ./commons
COPY ./oracle ./oracle
WORKDIR /mono/oracle

@ -42,9 +42,10 @@
"test": "yarn wsrun --exclude oracle-e2e --exclude ui-e2e --exclude monitor-e2e test",
"oracle-e2e": "./oracle-e2e/run-tests.sh",
"ui-e2e": "./ui-e2e/run-tests.sh",
"monitor-e2e": "./monitor-e2e/run-tests.sh",
"clean": "rm -rf ./node_modules ./**/node_modules ./**/**/node_modules ./**/build ./**/**/dist",
"compile:contracts": "yarn workspace token-bridge-contracts run compile",
"install:deploy": "cd contracts/deploy && npm install --unsafe-perm --silent",
"postinstall": "ln -sf $(pwd)/node_modules/openzeppelin-solidity/ contracts/node_modules/openzeppelin-solidity"
"postinstall": "test -n \"$NOYARNPOSTINSTALL\" || ln -sf $(pwd)/node_modules/openzeppelin-solidity/ contracts/node_modules/openzeppelin-solidity"
}
}

@ -1,21 +1,30 @@
FROM node:8 as contracts
WORKDIR /mono
COPY contracts/package.json contracts/package-lock.json ./contracts/
WORKDIR /mono/contracts
RUN npm install --only=prod
COPY ./contracts/truffle-config.js ./
COPY ./contracts/contracts ./contracts
RUN npm run compile
FROM node:8
WORKDIR /mono
COPY package.json .
COPY contracts/package.json ./contracts/
COPY --from=contracts /mono/contracts/build ./contracts/build
COPY commons/package.json ./commons/
COPY ui/package.json ./ui/
COPY ui/lib/web3-eth/index.js ./ui/lib/web3-eth/index.js
COPY yarn.lock .
RUN yarn install --production --frozen-lockfile
COPY ./contracts ./contracts
RUN yarn run compile:contracts
RUN mv ./contracts/build ./ && rm -rf ./contracts/* ./contracts/.[!.]* && mv ./build ./contracts/
RUN NOYARNPOSTINSTALL=1 yarn install --frozen-lockfile --production
COPY ./commons ./commons
COPY ./ui ./ui
ARG DOT_ENV_PATH=./ui/.env
COPY ${DOT_ENV_PATH} ./ui/.env