diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..a51933079 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,33 @@ +FROM python:3.6 +# Prepare user +RUN useradd -ms /bin/bash zcluser +WORKDIR /home/zcluser + +# Install zcl dependencies +RUN apt-get update +RUN apt-get install -y apt-utils +RUN apt-get install -y libleveldb1 libleveldb-dev +RUN apt-get install -y build-essential pkg-config libc6-dev m4 g++-multilib autoconf libtool ncurses-dev unzip git python zlib1g-dev wget bsdmainutils automake + +# Build zcl node daemon +RUN git clone https://github.com/z-classic/zclassic +RUN mkdir /home/zcluser/zcl_electrum_db +RUN /home/zcluser/zclassic/zcutil/build.sh -j$(nproc) + +# Install electrumx dependencies +RUN pip install pylru==1.0.9 +RUN pip install aiohttp==1.0.5 +RUN pip install x11_hash==1.4 +RUN pip install plyvel==0.9 + +COPY run_electrumx_docker.sh /home/zcluser/run_electrumx_docker.sh +RUN chown -R zcluser:zcluser /home/zcluser/zcl_electrum_db /home/zcluser/run_electrumx_docker.sh +RUN chmod 755 /home/zcluser/run_electrumx_docker.sh + +USER zcluser +RUN /home/zcluser/zclassic/zcutil/fetch-params.sh +RUN git clone https://github.com/BTCP-community/electrumx.git +RUN wget -q https://github.com/z-classic/zclassic/releases/download/Config/zclassic.conf +RUN sed -ie '/^rpcport=8232/a txindex=1' zclassic.conf + +ENTRYPOINT ["/bin/sh", "-c", "/home/zcluser/run_electrumx_docker.sh"] diff --git a/run_electrumx_docker.sh b/run_electrumx_docker.sh new file mode 100644 index 000000000..d8a090fa3 --- /dev/null +++ b/run_electrumx_docker.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +# Make self-signed SSL cert and key +openssl genrsa -des3 -passout pass:x -out server.pass.key 2048 +openssl rsa -passin pass:x -in server.pass.key -out server.key +openssl req -new -key server.key -out server.csr -subj "/C=NL/CN=electrumx.zclassic.org" +openssl x509 -req -days 1825 -in server.csr -signkey server.key -out server.crt +rm server.pass.key +rm server.csr + +# Update RPC username and password +sed -ie s/rpcuser=change-this/rpcuser=${RPCUSER}/ zclassic.conf +sed -ie s/rpcpassword=change-this/rpcpassword=${RPCPASS}/ zclassic.conf + +mkdir -p ~/.zclassic/ +cp zclassic.conf ~/.zclassic/ +/home/zcluser/zclassic/src/zcashd -daemon + +COIN=Zclassic DB_DIRECTORY=/home/zcluser/zcl_electrum_db DAEMON_URL=http://${RPCUSER}:${RPCPASS}@127.0.0.1:8232 HOST=0.0.0.0 SSL_PORT=50002 PEER_DISCOVERY=Off SSL_CERTFILE=/home/zcluser/server.crt SSL_KEYFILE=/home/zcluser/server.key BANDWIDTH_LIMIT=10000000 /home/zcluser/electrumx/electrumx_server.py