【比特币】快速搭建区块链浏览器
发布于 2 年前 作者 maiiz 1943 次浏览 来自 分享

说明

实测这个docker镜像是有效的,使用的是bitpay开源项目insight 原作者应该是btcc的人整理成docker镜像,github链接为:https://github.com/zouchao2010/insight 根据以下Dockerfile、run.sh,亲测有效

Dockerfile

FROM node:4.4.7

ENV TESTNET 0
ENV VERSION 0.1.0

WORKDIR /opt/insight

RUN apt-get update \
    && apt-get install -y wget libzmq3-dev \
    && apt-get autoremove -y \
    && apt-get clean -y \
    && apt-get autoclean -y \
    && rm -rf /var/lib/apt/lists/*

#install bitcore-node
RUN npm install -g bitcore-node@latest

ADD . /opt/insight

#create livenet insight
RUN bitcore-node create livenet \
    && cd livenet \
    && bitcore-node install insight-api \
    && bitcore-node install insight-ui \
    && mv node_modules ..

#create testnet insight
RUN bitcore-node create -t testnet \
    && cd testnet \
    && bitcore-node install insight-api \
    && bitcore-node install insight-ui \
    && rm -rf node_modules

VOLUME /var/lib/insight

RUN chmod 755 run.sh

EXPOSE 3001
CMD ["./run.sh"]

run.sh

#!/usr/bin/env bash

#copy livenet conf
if [ ! -d /var/lib/insight/livenet ]; then
    cp -r /opt/insight/livenet /var/lib/insight
    cp -r /opt/insight/node_modules /var/lib/insight/livenet
fi

#copy testnet conf
if [ ! -d /var/lib/insight/testnet ]; then
    cp -r /opt/insight/testnet /var/lib/insight
    cp -r /opt/insight/node_modules /var/lib/insight/testnet
fi

#run insight
if [ $TESTNET -eq 0 ];
then
    cd /var/lib/insight/livenet
    bitcore-node start | tee -a livenet.log
else
    cd /var/lib/insight/testnet
    bitcore-node start | tee -a testnet.log
fi
回到顶部