UI in docker (#102)

* Removed duplicate entry

* Started introducing ui dockerfile

* frozen lockfiles

* Removed unnecessary steps from Dockerfile.e2e

* Added start instruction

* Added docker-compose with instructions to UI

* Updated readme.

* Removed unnecessary command
This commit is contained in:
Przemyslaw Rzad 2019-06-14 15:50:22 +02:00 committed by GitHub
parent ca1cf80615
commit 8f47c93369
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 48 additions and 14 deletions

@ -2,17 +2,11 @@ FROM node:10
WORKDIR /mono
COPY package.json .
COPY oracle/package.json ./oracle/
COPY oracle-e2e/package.json ./oracle-e2e/
COPY ui/package.json ./ui/
COPY ui/lib/web3-eth/index.js ./ui/lib/web3-eth/index.js
COPY ui-e2e/package.json ./ui-e2e/
COPY monitor/package.json ./monitor/
COPY contracts/package.json ./contracts/
COPY ui/lib/web3-eth/index.js ./ui/lib/web3-eth/index.js
COPY yarn.lock .
RUN yarn install
RUN yarn install --frozen-lockfile
COPY ./contracts ./contracts
RUN yarn install:deploy
RUN yarn compile:contracts

@ -108,7 +108,7 @@ services:
ui:
build:
context: ..
dockerfile: Dockerfile.e2e
dockerfile: ui/Dockerfile
environment:
- REACT_APP_HOME_BRIDGE_ADDRESS=0x32198D570fffC7033641F8A9094FFDCaAEF42624
- REACT_APP_FOREIGN_BRIDGE_ADDRESS=0x2B6871b9B02F73fa24F4864322CdC78604207769
@ -134,7 +134,7 @@ services:
ui-erc20:
build:
context: ..
dockerfile: Dockerfile.e2e
dockerfile: ui/Dockerfile
environment:
- REACT_APP_HOME_BRIDGE_ADDRESS=0x1feB40aD9420b186F019A717c37f5546165d411E
- REACT_APP_FOREIGN_BRIDGE_ADDRESS=0x4a58D6d8D416a5fBCAcf3dC52eb8bE8948E25127
@ -160,7 +160,7 @@ services:
ui-erc20-native:
build:
context: ..
dockerfile: Dockerfile.e2e
dockerfile: ui/Dockerfile
environment:
- REACT_APP_HOME_BRIDGE_ADDRESS=0x488Af810997eD1730cB3a3918cD83b3216E6eAda
- REACT_APP_FOREIGN_BRIDGE_ADDRESS=0x488Af810997eD1730cB3a3918cD83b3216E6eAda

@ -26,9 +26,9 @@ while [ "$1" != "" ]; do
if [ "$1" == "ui" ]; then
docker-compose up -d ui ui-erc20 ui-erc20-native
docker-compose run -d -p 3000:3000 ui yarn workspace ui run start
docker-compose run -d -p 3001:3000 ui-erc20 yarn workspace ui run start
docker-compose run -d -p 3002:3000 ui-erc20-native yarn workspace ui run start
docker-compose run -d -p 3000:3000 ui yarn start
docker-compose run -d -p 3001:3000 ui-erc20 yarn start
docker-compose run -d -p 3002:3000 ui-erc20-native yarn start
fi
if [ "$1" == "deploy" ]; then

@ -12,7 +12,7 @@ COPY package.json .
COPY contracts/package.json ./contracts/
COPY oracle/package.json ./oracle/
COPY yarn.lock .
RUN yarn install --production
RUN yarn install --production --frozen-lockfile
COPY ./contracts ./contracts
RUN yarn run compile:contracts

18
ui/Dockerfile Normal file

@ -0,0 +1,18 @@
FROM node:8
WORKDIR /mono
COPY package.json .
COPY contracts/package.json ./contracts/
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/
COPY ./ui ./ui
WORKDIR /mono/ui
CMD echo "To start a UI application run:" \
"yarn start"

@ -140,10 +140,19 @@ cat ../poa-bridge-contracts/deploy/bridgeDeploymentResults.json
```
* Run the dApp
Using Yarn:
```
yarn start
```
Using Docker:
```
docker-compose up -d
```
The application will run on `http://localhost:PORT`, where `PORT` is specified in your `.env` file.
* Make sure your web3 wallet (Nifty Wallet, AlphaWallet or MetaMask) is funded and connected to the POA Sokol Network (see step 2)
* Specify an amount and click `Transfer` to complete a cross-chain transaction from Sokol to Kovan

13
ui/docker-compose.yml Normal file

@ -0,0 +1,13 @@
version: '2.4'
services:
ui:
build:
context: ..
dockerfile: ui/Dockerfile
ports:
- "${PORT}:${PORT}"
env_file: ./.env
environment:
- NODE_ENV=production
restart: unless-stopped
entrypoint: yarn start