dockerfiles: add binary zcashd base container
This commit is contained in:
commit
49ed9947e7
|
@ -0,0 +1,35 @@
|
|||
FROM debian:buster-slim
|
||||
|
||||
RUN apt-get update && apt-get install -y -q curl
|
||||
|
||||
RUN adduser --uid 1000 --system zcash && \
|
||||
mkdir -p /home/zcash/.zcash/ && \
|
||||
mkdir -p /home/zcash/.zcash-params/ && \
|
||||
chown -R zcash /home/zcash && \
|
||||
echo "Initialized user 'zcash'"
|
||||
|
||||
COPY download-zcashd.sh /home/zcash/
|
||||
COPY generate-config.sh /home/zcash/
|
||||
|
||||
USER zcash
|
||||
|
||||
WORKDIR /home/zcash/
|
||||
|
||||
ENV FILENAME "zcash-2.0.7-2-linux64-debian-stretch.tar.gz"
|
||||
ENV EXPECTED_HASH "597d169606ed2d1b621d80f39c06291ff01d57cae8f178c0d6e90df1a27405ed"
|
||||
|
||||
# This should fail if the hash does not match the expected hash.
|
||||
RUN ./download-zcashd.sh
|
||||
|
||||
# Create a zcash.conf for testnet with random RPC credentials
|
||||
RUN ./generate-config.sh
|
||||
RUN mv ./zcash.conf /home/zcash/.zcash/
|
||||
|
||||
# Extract the tarball.
|
||||
RUN tar xvf $FILENAME
|
||||
|
||||
# Change this for each new version.
|
||||
WORKDIR ./zcash-2.0.7-2
|
||||
|
||||
VOLUME [/home/zcash/.zcash]
|
||||
VOLUME [/home/zcash/.zcash-params]
|
|
@ -0,0 +1,34 @@
|
|||
#!/bin/bash
|
||||
set -euxo pipefail
|
||||
|
||||
WORKDIR=`pwd`
|
||||
|
||||
function download_zcashd {
|
||||
EXPECTED_HASH=${EXPECTED_HASH:-"597d169606ed2d1b621d80f39c06291ff01d57cae8f178c0d6e90df1a27405ed"}
|
||||
FILENAME=${FILENAME:-"zcash-2.0.7-2-linux64-debian-stretch.tar.gz"}
|
||||
#BASE_URL_ZCASH="https://z.cash/downloads"
|
||||
BASE_URL_MIRROR="https://storage.googleapis.com/zcashd-release-mirror/zcash-2.0.7-2"
|
||||
|
||||
DOWNLOAD_DIR=`mktemp -d`
|
||||
|
||||
cd ${DOWNLOAD_DIR}
|
||||
|
||||
curl -OL ${BASE_URL_MIRROR}/${FILENAME}
|
||||
|
||||
cat <<- EOF > ${DOWNLOAD_DIR}/SHA256SUMS
|
||||
${EXPECTED_HASH} ${FILENAME}
|
||||
EOF
|
||||
|
||||
if sha256sum -c ${DOWNLOAD_DIR}/SHA256SUMS; then
|
||||
echo "DOWNLOAD OK"
|
||||
cp ${FILENAME} ${WORKDIR}/
|
||||
rm -rf ${DOWNLOAD_DIR}
|
||||
return
|
||||
fi
|
||||
|
||||
echo "DOWNLOAD SAYS NOPE"
|
||||
rm -rf ${DOWNLOAD_DIR}
|
||||
exit 1
|
||||
}
|
||||
|
||||
download_zcashd
|
|
@ -0,0 +1,19 @@
|
|||
#!/bin/bash
|
||||
set -euxo pipefail
|
||||
|
||||
WORKDIR=`pwd`
|
||||
|
||||
function generate_config {
|
||||
RPC_USER=$(head -c 32 /dev/urandom | base64)
|
||||
RPC_PASS=$(head -c 32 /dev/urandom | base64)
|
||||
|
||||
cat <<- EOF > ${WORKDIR}/zcash.conf
|
||||
testnet=1
|
||||
addnode=testnet.z.cash
|
||||
rpcport=8232
|
||||
rpcuser=${RPC_USER}
|
||||
rpcpassword=${RPC_PASS}
|
||||
EOF
|
||||
}
|
||||
|
||||
generate_config
|
Loading…
Reference in New Issue