adding patch for dockerfile and according makefile targets
This commit is contained in:
parent
a457821949
commit
1e8cfac8a9
|
@ -0,0 +1,97 @@
|
|||
# /************************************************************************
|
||||
# File: Dockerfile
|
||||
# Author: mdr0id
|
||||
# Date: 9/3/2019
|
||||
# Description: Used for devs that have not built zcash or lightwalletd on
|
||||
# on existing system
|
||||
# USAGE:
|
||||
#
|
||||
# To build image: make docker_img
|
||||
# To run container: make docker_image_run
|
||||
#
|
||||
# This will place you into the container where you can run zcashd, zcash-cli,
|
||||
# lightwalletd ingester, and lightwalletd server etc..
|
||||
#
|
||||
# First you need to get zcashd sync to current height on testnet, from outside container:
|
||||
# make docker_img_run_zcashd
|
||||
#
|
||||
# Sometimes you need to manually start zcashd for the first time, from insdie the container:
|
||||
# zcashd -printtoconsole
|
||||
#
|
||||
# Once the block height is atleast 280,000 you can go ahead and start lightwalletd components
|
||||
# make docker_img_run_lightwalletd_ingest
|
||||
# make docker_img_run_lightwalletd_insecure_server
|
||||
#
|
||||
# If you get kicked out of docker or it locks up...
|
||||
# To restart, check to see what container you want to restart via docker ps -a
|
||||
# Then, docker restart <container id>
|
||||
# The reattach to it, docker attach <container id>
|
||||
#
|
||||
# Known bugs/missing features/todos:
|
||||
#
|
||||
# *** DO NOT USE IN PRODUCTION ***
|
||||
#
|
||||
# 1. Create docker-compose with according .env scaffolding
|
||||
# 2. Setup container volume for blocks dir; remove sync time
|
||||
# 3. Determine librustzcash bug that breaks zcashd alpine builds at runtime
|
||||
# 4. Once versioning is stable add config flags for images
|
||||
# 5. Add mainnet config once lightwalletd stack supports it
|
||||
#
|
||||
# ************************************************************************/
|
||||
|
||||
# Create layer in case you want to modify local lightwalletd code
|
||||
FROM golang:1.11 AS lightwalletd_base
|
||||
|
||||
ENV ZCASH_CONF=/root/.zcash/zcash.conf
|
||||
ENV LIGHTWALLETD_URL=https://github.com/zcash-hackworks/lightwalletd.git
|
||||
|
||||
RUN apt-get update && apt-get install make git gcc
|
||||
WORKDIR /home
|
||||
|
||||
# Comment out line below to use local lightwalletd repo changes
|
||||
RUN git clone ${LIGHTWALLETD_URL}
|
||||
|
||||
# To add local changes to container uncomment this line
|
||||
#ADD . /home
|
||||
|
||||
RUN cd ./lightwalletd && make
|
||||
RUN /usr/bin/install -c /home/lightwalletd/ingest /home/lightwalletd/server /usr/bin/
|
||||
|
||||
# Setup layer for zcashd and zcash-cli binary
|
||||
FROM golang:1.11 AS zcash_builder
|
||||
|
||||
ENV ZCASH_URL=https://github.com/zcash/zcash.git
|
||||
|
||||
RUN apt-get update && apt-get install \
|
||||
build-essential pkg-config libc6-dev m4 g++-multilib \
|
||||
autoconf libtool ncurses-dev unzip git python python-zmq \
|
||||
zlib1g-dev wget curl bsdmainutils automake python-pip -y
|
||||
|
||||
WORKDIR /build
|
||||
RUN git clone ${ZCASH_URL}
|
||||
|
||||
RUN ./zcash/zcutil/build.sh -j$(nproc)
|
||||
RUN bash ./zcash/zcutil/fetch-params.sh
|
||||
RUN /usr/bin/install -c /build/zcash/src/zcashd /build/zcash/src/zcash-cli /usr/bin/
|
||||
|
||||
# Create layer for lightwalletd and zcash binaries to reduce image size
|
||||
FROM golang:1.11 AS zcash_runner
|
||||
ENV ZCASH_CONF=/root/.zcash/zcash.conf
|
||||
|
||||
RUN mkdir -p /root/.zcash/ && \
|
||||
mkdir -p /root/.zcash-params/ && \
|
||||
mkdir /logs/ && \
|
||||
mkdir /db/
|
||||
|
||||
# Use lightwallet server and ingest binaries from prior layer
|
||||
COPY --from=lightwalletd_base /usr/bin/ingest /usr/bin/server /usr/bin/
|
||||
COPY --from=zcash_builder /usr/bin/zcashd /usr/bin/zcash-cli /usr/bin/
|
||||
COPY --from=zcash_builder /root/.zcash-params/ /root/.zcash-params/
|
||||
|
||||
# Configure zcash.conf
|
||||
RUN echo "testnet=1" >> ${ZCASH_CONF} && \
|
||||
echo "addnode=testnet.z.cash" >> ${ZCASH_CONF} && \
|
||||
echo "rpcbind=127.0.0.1" >> ${ZCASH_CONF} && \
|
||||
echo "rpcport=18232" >> ${ZCASH_CONF} && \
|
||||
echo "rpcuser=lwd" >> ${ZCASH_CONF} && \
|
||||
echo "rpcpassword=`head /dev/urandom | tr -dc A-Za-z0-9 | head -c 13 ; echo ''`" >> ${ZCASH_CONF}
|
32
Makefile
32
Makefile
|
@ -54,8 +54,36 @@ docs:
|
|||
@echo "Generating docs..."
|
||||
|
||||
# Generate docker image
|
||||
image:
|
||||
@echo "Building lightwalletd image..."
|
||||
docker_img:
|
||||
docker build -t zcash_lwd_base .
|
||||
|
||||
# Run the above docker image in a container
|
||||
docker_img_run:
|
||||
docker run -i --name zcashdlwd zcash_lwd_base
|
||||
|
||||
# Execture a bash process on zcashdlwdcontainer
|
||||
docker_img_bash:
|
||||
docker exec -it zcashdlwd bash
|
||||
|
||||
# Start the zcashd process in the zcashdlwd container
|
||||
docker_img_run_zcashd:
|
||||
docker exec -i zcashdlwd zcashd -printtoconsole
|
||||
|
||||
# Stop the zcashd process in the zcashdlwd container
|
||||
docker_img_stop_zcashd:
|
||||
docker exec -i zcashdlwd zcash-cli stop
|
||||
|
||||
# Start the lightwalletd ingester in the zcashdlwd container
|
||||
docker_img_run_lightwalletd_ingest:
|
||||
docker exec -i zcashdlwd ingest --conf-file /root/.zcash/zcash.conf --db-path /db/sql.db --log-file /logs/ingest.log
|
||||
|
||||
# Start the lightwalletd server in the zcashdlwd container
|
||||
docker_img_run_lightwalletd_insecure_server:
|
||||
docker exec -i zcashdlwd server --very-insecure=true --conf-file /root/.zcash/zcash.conf --db-path /db/sql.db --log-file /logs/server.log --bind-addr 127.0.0.1:18232
|
||||
|
||||
# Remove and delete ALL images and containers in Docker; assumes containers are stopped
|
||||
docker_remove_all:
|
||||
docker system prune -f
|
||||
|
||||
# Get dependencies
|
||||
dep:
|
||||
|
|
Loading…
Reference in New Issue