initial commit

This commit is contained in:
Jeffrey Paul 2016-04-11 05:38:48 +02:00
commit 9a29fdeffd
Signed by: sneak
GPG Key ID: 052443F4DF2A55C2
5 changed files with 96 additions and 0 deletions

47
Dockerfile Normal file
View File

@ -0,0 +1,47 @@
FROM phusion/baseimage:0.9.18
ENV BITCOIND_VERSION 0.12.0
ADD ./sources.list /etc/apt/sources.list
ADD \
https://github.com/bitcoin/bitcoin/archive/v$BITCOIND_VERSION.tar.gz \
/usr/local/src/bitcoin.tgz
RUN apt-get update && \
apt-get install -y \
build-essential libtool autotools-dev automake pkg-config libssl-dev \
libevent-dev bsdmainutils libboost-all-dev libzmq3 libzmq3-dev \
libminiupnpc-dev && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN cd /usr/local/src && \
tar zxvf bitcoin.tgz && \
rm bitcoin.tgz
RUN cd /usr/local/src/bitcoin* && \
./autogen.sh && \
./configure --disable-wallet --enable-hardening && \
make -j10 && \
make install
RUN apt-get remove -y \
build-essential libtool autotools-dev automake pkg-config libssl-dev \
libevent-dev bsdmainutils libboost-all-dev libzmq3-dev \
libminiupnpc-dev && \
apt-get autoremove -y && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
ENV HOME /var/lib/bitcoin
RUN useradd -s /bin/bash -m -d /var/lib/bitcoin bitcoin
RUN chown bitcoin:bitcoin -R /var/lib/bitcoin
VOLUME ["/var/lib/bitcoin/.bitcoin"]
EXPOSE 8332
EXPOSE 8333
RUN mkdir -p /etc/service/bitcoin
ADD bitcoin.run /etc/service/bitcoin/run
RUN mkdir -p /etc/service/bitcoin/log
ADD bitcoin.log.run /etc/service/bitcoin/log/run
RUN chmod +x /etc/service/bitcoin/log/run \
/etc/service/bitcoin/run

11
Makefile Normal file
View File

@ -0,0 +1,11 @@
default: build
build: kill
docker build -t sneak/bitcoind .
run: kill
docker run --name sneak-bitcoind -d sneak/bitcoind
docker logs -f sneak-bitcoind
kill:
-docker rm -f sneak-bitcoind

2
bitcoin.log.run Normal file
View File

@ -0,0 +1,2 @@
#!/bin/sh
exec chpst -usyslog logger -t bitcoind

28
bitcoin.run Normal file
View File

@ -0,0 +1,28 @@
#!/bin/bash
export HOME="/var/lib/bitcoin"
# gen random pw for rpc server
DEFAULTPW=$(dd if=/dev/urandom bs=10 count=1 status=none | shasum | cut -b 1-20)
if [ ! -e "$HOME/bitcoin.conf" ]; then
echo "creating bitcoin.conf"
cat <<EOF > $HOME/bitcoin.conf
rpcuser=${BITCOIND_RPC_USER:-rpcuser}
rpcpassword=${BITCOIND_RPC_PASSWORD:-$DEFAULTPW}
EOF
fi
chown -R bitcoin:bitcoin $HOME
exec chpst -ubitcoin \
bitcoind \
-printtoconsole \
-disablewallet \
-datadir $HOME \
-conf $HOME/bitcoin.conf \
-rpcallowip=::/0 \
$BITCOIND_EXTRA_OPTS \
2>&1

8
sources.list Normal file
View File

@ -0,0 +1,8 @@
deb mirror://mirrors.ubuntu.com/mirrors.txt trusty main universe
deb mirror://mirrors.ubuntu.com/mirrors.txt trusty-updates main universe
deb mirror://mirrors.ubuntu.com/mirrors.txt trusty-security main universe
deb mirror://mirrors.ubuntu.com/mirrors.txt trusty-backports main universe
#deb http://archive.ubuntu.com/ubuntu trusty main universe
#deb http://archive.ubuntu.com/ubuntu trusty-updates main universe
#deb http://archive.ubuntu.com/ubuntu trusty-security main universe
#deb http://archive.ubuntu.com/ubuntu trusty-backports main universe