Created initial docker configurations for running dev binance testnet inside test environment

This commit is contained in:
Kirill Fedoseev 2019-11-08 11:38:53 +03:00
parent 37a5c1e989
commit d00d78ec6c
8 changed files with 100 additions and 4 deletions

View File

@ -0,0 +1,11 @@
FROM node:10.16.0-alpine
WORKDIR /api-server
COPY ./package.json ./
RUN npm install
COPY ./index.js ./
ENTRYPOINT ["node", "./index.js"]

View File

@ -0,0 +1,12 @@
const fs = require('fs')
const express = require('express')
const app = express()
app.get('/', (req, res) => {
res.send(fs.readFileSync('./marketdata/marketdata.json').toString())
})
app.listen(8000, () => {
console.log('Listening on port 8000')
})

View File

@ -0,0 +1,11 @@
{
"name": "api-server",
"version": "0.0.1",
"dependencies": {
"express": "4.17.1",
"axios": "0.19.0"
},
"engines": {
"node": ">=10.6.0"
}
}

View File

@ -0,0 +1,21 @@
version: '3.0'
services:
testnet:
build: ./testnet
image: bnc-testnet
volumes:
- 'marketdata:/root/.bnbchaind/marketdata'
api-server:
build: ./api-server
image: bnc-api-server
networks:
- binance_net
ports:
- '8000:8000'
volumes:
- 'marketdata:/api-server/marketdata'
networks:
binance_net:
external: true
volumes:
marketdata:

6
src/binance-testnet/run.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
set -e
docker network create binance_net > /dev/null 2>&1 || true
docker-compose up --build

View File

@ -0,0 +1,35 @@
FROM ubuntu:19.10 as build
ARG BNC_VERSION=0.6.2
RUN apt-get update && \
apt-get install -y git git-lfs
WORKDIR /binaries
RUN GIT_LFS_SKIP_SMUDGE=1 git clone --depth 1 https://github.com/binance-chain/node-binary.git .
RUN git lfs pull -I fullnode/testnet/${BNC_VERSION}/linux
RUN git lfs pull -I cli/testnet/${BNC_VERSION}/linux
RUN ./fullnode/testnet/${BNC_VERSION}/linux/bnbchaind testnet --acc-prefix tbnb --chain-id Binance-Dev --v 1
RUN sed -i "s/publishTransfer = false/publishTransfer = true/" ./mytestnet/node0/gaiad/config/app.toml && \
sed -i "s/publishLocal = false/publishLocal = true/" ./mytestnet/node0/gaiad/config/app.toml
#echo 12345678 | docker exec -i 5f6f653730442d81b6e34a82ac3dc8a82f071c1eec130bc09a0dca803ad00bd2 ./tbnbcli send --to tbnb1efjg7xt98t67ql2cmwjc5860lgayet9l8m55ym --amount 100:BNB --from node0 --chain-id Binance-Dev --json
FROM alpine:3.9.4
ARG BNC_VERSION=0.6.2
WORKDIR /bnc
COPY --from=build /binaries/fullnode/testnet/${BNC_VERSION}/linux/bnbchaind ./
COPY --from=build /binaries/cli/testnet/${BNC_VERSION}/linux/tbnbcli ./
COPY --from=build /binaries/mytestnet/node0/gaiacli /root/.bnbcli
COPY --from=build /binaries/mytestnet/node0/gaiad /root/.bnbchaind
EXPOSE 26657
ENTRYPOINT ["./bnbchaind", "start"]

View File

@ -15,8 +15,8 @@ services:
- FOREIGN_URL
- FOREIGN_ASSET
- LOG_LEVEL
- "GAS_LIMIT_FACTOR=3"
- "MAX_GAS_LIMIT=6000000"
- 'GAS_LIMIT_FACTOR=3'
- 'MAX_GAS_LIMIT=6000000'
ports:
- '${VOTES_PROXY_PORT}:8002'
networks:

View File

@ -15,8 +15,8 @@ services:
- FOREIGN_URL
- FOREIGN_ASSET
- LOG_LEVEL
- "GAS_LIMIT_FACTOR=3"
- "MAX_GAS_LIMIT=6000000"
- 'GAS_LIMIT_FACTOR=3'
- 'MAX_GAS_LIMIT=6000000'
ports:
- '${VOTES_PROXY_PORT}:8002'
networks: