diff --git a/docker/Dockerfile b/docker/Dockerfile index d0a35a078..91d9bd0ee 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,36 +1,31 @@ -FROM ubuntu:14.04 +FROM ubuntu:utopic +MAINTAINER caktux ENV DEBIAN_FRONTEND noninteractive + +# Usual update / upgrade RUN apt-get update -RUN apt-get upgrade -y +RUN apt-get upgrade -q -y +RUN apt-get dist-upgrade -q -y -# Ethereum dependencies -RUN apt-get install -qy build-essential g++-4.8 git cmake libboost-all-dev libcurl4-openssl-dev wget -RUN apt-get install -qy automake unzip libgmp-dev libtool libleveldb-dev yasm libminiupnpc-dev libreadline-dev scons -RUN apt-get install -qy libjsoncpp-dev libargtable2-dev -RUN apt-get install -qy libncurses5-dev libcurl4-openssl-dev wget -RUN apt-get install -qy libjsoncpp-dev libargtable2-dev libmicrohttpd-dev +# Let our containers upgrade themselves +RUN apt-get install -q -y unattended-upgrades -# Ethereum PPA -RUN apt-get install -qy software-properties-common +# Install Ethereum +RUN apt-get install -q -y software-properties-common RUN add-apt-repository ppa:ethereum/ethereum RUN add-apt-repository ppa:ethereum/ethereum-dev RUN apt-get update -RUN apt-get install -qy libcryptopp-dev libjson-rpc-cpp-dev +RUN apt-get install -q -y eth -# LLVM-3.5 -RUN wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key|sudo apt-key add - -RUN echo "deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.5 main\ndeb-src http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.5 main" > /etc/apt/sources.list.d/llvm-trusty.list -RUN apt-get update -RUN apt-get install -qy llvm-3.5 libedit-dev +# Install supervisor +RUN apt-get install -q -y supervisor -# Fix llvm-3.5 cmake paths -RUN mkdir -p /usr/lib/llvm-3.5/share/llvm && ln -s /usr/share/llvm-3.5/cmake /usr/lib/llvm-3.5/share/llvm/cmake +# Add supervisor configs +ADD supervisord.conf supervisord.conf -# Build Ethereum (HEADLESS) -RUN git clone --depth=1 https://github.com/ethereum/cpp-ethereum -RUN mkdir -p cpp-ethereum/build -RUN cd cpp-ethereum/build && cmake .. -DHEADLESS=1 -DLLVM_DIR=/usr/share/llvm-3.5/cmake -DEVMJIT=1 && make -j $(cat /proc/cpuinfo | grep processor | wc -l) && make install -RUN ldconfig +EXPOSE 8080 +EXPOSE 30303 -ENTRYPOINT ["/usr/local/bin/eth"] +CMD ["-n", "-c", "/supervisord.conf"] +ENTRYPOINT ["/usr/bin/supervisord"] diff --git a/docker/README.md b/docker/README.md index 634ba56da..b94c7cb76 100644 --- a/docker/README.md +++ b/docker/README.md @@ -1,17 +1,30 @@ # Dockerfile for cpp-ethereum -Dockerfile to build a bleeding edge cpp-ethereum docker image from source - docker build -t cppeth < Dockerfile +### Quick usage -Run a simple peer server + docker run -d ethereum/client-cpp - docker run -i cppeth -m off -o peer -x 256 +### Building -GUI is compiled but not exposed. You can mount /cpp-ethereum/build to access binaries: +Dockerfile to build a cpp-ethereum docker image from source - cid = $(docker run -i -v /cpp-ethereum/build cppeth -m off -o peer -x 256) - docker inspect $cid # <-- Find volume path in JSON output + docker build -t cpp-ethereum . -You may also modify the Docker image to run the GUI and expose a -ssh/VNC server in order to tunnel an X11 or VNC session. +### Running + docker run -d cpp-ethereum + +### Usage + +First enter the container: + + docker exec -it bash + +Inspect logs: + + cat /var/log/cpp-ethereum.log + cat /var/log/cpp-ethereum.err + +Restart supervisor service: + + supervisorctl restart cpp-ethereum diff --git a/docker/supervisord.conf b/docker/supervisord.conf new file mode 100644 index 000000000..abae9685c --- /dev/null +++ b/docker/supervisord.conf @@ -0,0 +1,23 @@ +[supervisord] +nodaemon=false + +[program:eth] +priority=30 +directory=/ +command=eth --bootstrap --json-rpc +user=root +autostart=true +autorestart=true +startsecs=10 +stopsignal=QUIT +stdout_logfile=/var/log/eth.log +stderr_logfile=/var/log/eth.err + +[unix_http_server] +file=%(here)s/supervisor.sock + +[supervisorctl] +serverurl=unix://%(here)s/supervisor.sock + +[rpcinterface:supervisor] +supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface \ No newline at end of file