Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build zcash on any system w/ Docker+bash via ./contrib/dev-docker/run.sh. #4741

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
35 changes: 35 additions & 0 deletions contrib/dev-docker/Dockerfile
@@ -0,0 +1,35 @@
# Reference: https://zcash.readthedocs.io/en/latest/rtd_pages/Debian-Ubuntu-build.html "building from source"
FROM debian:stretch

RUN DEBIAN_FRONTEND=noninteractive \
apt-get update && \
DEBIAN_FRONTEND=noninteractive \
apt-get install -qq \
autoconf \
automake \
bsdmainutils \
build-essential \
curl \
g++-multilib \
git \
libc6-dev \
libtool \
m4 \
ncurses-dev \
pkg-config \
python3 \
python3-zmq \
unzip \
zlib1g-dev

ARG BUILDER_UID
RUN adduser \
--uid "$BUILDER_UID" \
--no-create-home \
--disabled-password \
--gecos '' \
builder

USER builder

ENTRYPOINT ["/workspace/zcutil/build.sh"]
7 changes: 7 additions & 0 deletions contrib/dev-docker/README.md
@@ -0,0 +1,7 @@
# zcash development Dockerfile

This Dockerfile provides the build toolchain for building zcashd via `/zcutil/build.sh'. The entrypoint is that build script, so that anyone with docker can do development builds without installing the dev toolchain directly.

## Wrapper script

A wrapper script `./run.sh` will build and run the image with the appropriate bind mount and other settings so that the resulting change to the repo directory is the same as if a user had run `./zcutil/build.sh` with the dev toolchain installed locally.
14 changes: 14 additions & 0 deletions contrib/dev-docker/run.sh
@@ -0,0 +1,14 @@
#!/bin/bash
set -efuxo pipefail

# cd to the repo root:
cd "$(readlink -f "$0/../../../")"
docker build \
-t zcash-dev-docker \
--build-arg "BUILDER_UID=$(id -u)" \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On linux, this will need to be run with sudo (as docker doesn't allow execution without superuser permissions.); however, if you run the whole run.sh script with sudo then id -u returns 0, which then fails the adduser call in the dockerfile.

This should be documented and overrideable.

./contrib/dev-docker/

exec docker run \
-v "$(pwd)/:/workspace" \
zcash-dev-docker \
"$@"