From 8d176d7cd13ec3bae884daefc2f5ca68d45087f6 Mon Sep 17 00:00:00 2001 From: Spike Date: Tue, 2 May 2017 13:52:07 +0200 Subject: [PATCH] initial --- bitcoin-core/0.14-BIP148/Dockerfile | 48 ++++++++++ bitcoin-core/0.14-BIP148/README | 3 + bitcoin-core/0.14-BIP148/docker-entrypoint.sh | 20 ++++ bitcoin-core/Dockerfile | 44 +++++++++ bitcoin-core/docker-entrypoint.sh | 19 ++++ storj/dockerfiles/docker-entrypoint.sh | 33 +++++++ .../storjshare-daemon-ubuntu.dockerfile | 21 ++++ .../storjshare-daemon-win.dockerfile | 96 +++++++++++++++++++ 8 files changed, 284 insertions(+) create mode 100644 bitcoin-core/0.14-BIP148/Dockerfile create mode 100644 bitcoin-core/0.14-BIP148/README create mode 100755 bitcoin-core/0.14-BIP148/docker-entrypoint.sh create mode 100644 bitcoin-core/Dockerfile create mode 100755 bitcoin-core/docker-entrypoint.sh create mode 100755 storj/dockerfiles/docker-entrypoint.sh create mode 100644 storj/dockerfiles/storjshare-daemon-ubuntu.dockerfile create mode 100644 storj/dockerfiles/storjshare-daemon-win.dockerfile diff --git a/bitcoin-core/0.14-BIP148/Dockerfile b/bitcoin-core/0.14-BIP148/Dockerfile new file mode 100644 index 0000000..31b63ee --- /dev/null +++ b/bitcoin-core/0.14-BIP148/Dockerfile @@ -0,0 +1,48 @@ +FROM phusion/baseimage:latest + +RUN groupadd -r bitcoin && useradd -r -m -g bitcoin bitcoin + +ENV BITCOIN_VERSION 0.14.0 +ENV FILENAME bitcoin-0.14.0-x86_64-linux-gnu.tar.gz +ENV BITCOIN_DIR /bitcoin + +RUN set -ex \ + && apt-get update \ + && apt-get install -y --no-install-recommends ca-certificates wget \ + && rm -rf /var/lib/apt/lists/* \ + + # grab gosu for easy step-down from root + && gpg --keyserver pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \ + && wget -qO /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/1.7/gosu-$(dpkg --print-architecture)" \ + && wget -qO /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/1.7/gosu-$(dpkg --print-architecture).asc" \ + && gpg --verify /usr/local/bin/gosu.asc \ + && rm /usr/local/bin/gosu.asc \ + && chmod +x /usr/local/bin/gosu \ + + # remove build dependencies + && apt-get purge -y --auto-remove wget + +WORKDIR $BITCOIN_DIR + +COPY $FILENAME . + +RUN tar zxvf $FILENAME +RUN mv bitcoin-$BITCOIN_VERSION/* . +RUN rm -rf $FILENAME +RUN rm -rf bitcoin-$BITCOIN_VERSION + + +ENV BITCOIN_DATA /data +RUN mkdir $BITCOIN_DATA \ + && chown bitcoin:bitcoin $BITCOIN_DATA\ + && ln -s $BITCOIN_DATA /home/bitcoin/.bitcoin +# Add bitcoin binary path to $PATH +ENV PATH $BITCOIN_DIR/bin:$PATH +VOLUME /data + +COPY docker-entrypoint.sh /entrypoint.sh +ENTRYPOINT ["/entrypoint.sh"] + +EXPOSE 8333 18333 +CMD ["bitcoind"] + diff --git a/bitcoin-core/0.14-BIP148/README b/bitcoin-core/0.14-BIP148/README new file mode 100644 index 0000000..3b3d018 --- /dev/null +++ b/bitcoin-core/0.14-BIP148/README @@ -0,0 +1,3 @@ +Compile bitcoin using gitian following official doc +Download compiled files to current working dir +Update Dockerfile with the bitcoin version you want to install diff --git a/bitcoin-core/0.14-BIP148/docker-entrypoint.sh b/bitcoin-core/0.14-BIP148/docker-entrypoint.sh new file mode 100755 index 0000000..6737837 --- /dev/null +++ b/bitcoin-core/0.14-BIP148/docker-entrypoint.sh @@ -0,0 +1,20 @@ +#!/bin/bash +set -e + +if [ "$1" = 'bitcoin-cli' -o "$1" = 'bitcoin-tx' -o "$1" = 'bitcoind' -o "$1" = 'test_bitcoin' ]; then + mkdir -p "$BITCOIN_DATA" + + if [ ! -s "$BITCOIN_DATA/bitcoin.conf" ]; then + cat <<-EOF > "$BITCOIN_DATA/bitcoin.conf" + printtoconsole=1 + uacomment=BIP148-UASF + rpcpassword=${BITCOIN_RPC_PASSWORD:-password} + rpcuser=${BITCOIN_RPC_USER:-bitcoin} + EOF + fi + + chown -R bitcoin "$BITCOIN_DATA" + exec gosu bitcoin "$@" +fi + +exec "$@" diff --git a/bitcoin-core/Dockerfile b/bitcoin-core/Dockerfile new file mode 100644 index 0000000..c65c0a4 --- /dev/null +++ b/bitcoin-core/Dockerfile @@ -0,0 +1,44 @@ +FROM phusion/baseimage:latest + +RUN groupadd -r bitcoin && useradd -r -m -g bitcoin bitcoin + +ENV BITCOIN_VERSION 0.13.2 +ENV BITCOIN_URL https://bitcoin.org/bin/bitcoin-core-0.13.2/bitcoin-0.13.2-x86_64-linux-gnu.tar.gz +ENV BITCOIN_SHA256 29215a7fe7430224da52fc257686d2d387546eb8acd573a949128696e8761149 +ENV BITCOIN_ASC_URL https://bitcoin.org/bin/bitcoin-core-0.13.2/SHA256SUMS.asc +ENV BITCOIN_PGP_KEY 01EA5486DE18A882D4C2684590C8019E36C2E964 + +RUN set -ex \ + && apt-get update \ + && apt-get install -y --no-install-recommends ca-certificates wget \ + && rm -rf /var/lib/apt/lists/* \ + + # grab gosu for easy step-down from root + && gpg --keyserver pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \ + && wget -qO /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/1.7/gosu-$(dpkg --print-architecture)" \ + && wget -qO /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/1.7/gosu-$(dpkg --print-architecture).asc" \ + && gpg --verify /usr/local/bin/gosu.asc \ + && rm /usr/local/bin/gosu.asc \ + && chmod +x /usr/local/bin/gosu \ + + # Add bitcoin ppa + && add-apt-repository -y ppa:bitcoin/bitcoin \ + && apt-get update \ + + # install bitcoin binaries + && apt-get install -y bitcoind \ + + # remove build dependencies + && apt-get purge -y --auto-remove wget + +ENV BITCOIN_DATA /data +RUN mkdir $BITCOIN_DATA \ + && chown bitcoin:bitcoin $BITCOIN_DATA \ + && ln -s $BITCOIN_DATA /home/bitcoin/.bitcoin +VOLUME /data + +COPY docker-entrypoint.sh /entrypoint.sh +ENTRYPOINT ["/entrypoint.sh"] + +EXPOSE 8333 18333 +CMD ["bitcoind"] diff --git a/bitcoin-core/docker-entrypoint.sh b/bitcoin-core/docker-entrypoint.sh new file mode 100755 index 0000000..9c860f2 --- /dev/null +++ b/bitcoin-core/docker-entrypoint.sh @@ -0,0 +1,19 @@ +#!/bin/bash +set -e + +if [ "$1" = 'bitcoin-cli' -o "$1" = 'bitcoin-tx' -o "$1" = 'bitcoind' -o "$1" = 'test_bitcoin' ]; then + mkdir -p "$BITCOIN_DATA" + + if [ ! -s "$BITCOIN_DATA/bitcoin.conf" ]; then + cat <<-EOF > "$BITCOIN_DATA/bitcoin.conf" + printtoconsole=1 + rpcpassword=${BITCOIN_RPC_PASSWORD:-password} + rpcuser=${BITCOIN_RPC_USER:-bitcoin} + EOF + fi + + chown -R bitcoin "$BITCOIN_DATA" + exec gosu bitcoin "$@" +fi + +exec "$@" diff --git a/storj/dockerfiles/docker-entrypoint.sh b/storj/dockerfiles/docker-entrypoint.sh new file mode 100755 index 0000000..492ea76 --- /dev/null +++ b/storj/dockerfiles/docker-entrypoint.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +set -e + +STORJ_ADDRESS=1CT76j4GRhad1CXdngpzVLWjnpVLSGt7Ec +STORJ_CONFIG=/root/.config/storjshare/config.json +STORJ_LOG=/root/.config/storjshare/log +STORJ_STORAGE=/storage + +if [ "$1" = 'storjshare' ];then + + storjshare-daemon start + + if [ ! -s "$STORJ_CONFIG" ];then + storjshare create \ + --sjcx $STORJ_ADDRESS \ + -o $STORJ_CONFIG --noedit \ + --logfile $STORJ_LOG \ + --size 50GB \ + --storage $STORJ_STORAGE + + fi + + storjshare start --config $STORJ_CONFIG + tail -f $STORJ_LOG +fi + +"$@" + + + + + diff --git a/storj/dockerfiles/storjshare-daemon-ubuntu.dockerfile b/storj/dockerfiles/storjshare-daemon-ubuntu.dockerfile new file mode 100644 index 0000000..bbfb73a --- /dev/null +++ b/storj/dockerfiles/storjshare-daemon-ubuntu.dockerfile @@ -0,0 +1,21 @@ +FROM ubuntu:latest +MAINTAINER Storj Labs (bill@storj.io) + +RUN apt-get update && apt-get -y upgrade && \ +apt-get -y install curl && \ +curl -sL https://deb.nodesource.com/setup_6.x | bash - && \ +apt-get -y install vim libssl-dev nodejs git python build-essential && \ +node --version && \ +npm --version && \ +python --version && \ +npm install --global storjshare-daemon && \ +storjshare --version + +VOLUME /root/.config +VOLUME /storage + +COPY docker-entrypoint.sh /entrypoint.sh +ENTRYPOINT ["/entrypoint.sh"] +CMD ["storjshare"] + +EXPOSE 4000 4001 4002 4003 diff --git a/storj/dockerfiles/storjshare-daemon-win.dockerfile b/storj/dockerfiles/storjshare-daemon-win.dockerfile new file mode 100644 index 0000000..7968618 --- /dev/null +++ b/storj/dockerfiles/storjshare-daemon-win.dockerfile @@ -0,0 +1,96 @@ +FROM microsoft/windowsservercore +MAINTAINER Storj Labs (bill@storj.io) +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"] + +ENV NPM_CONFIG_LOGLEVEL info +ENV NODE_VERSION 6.9.2 +ENV MINGIT_VERSION 2.11.0 + +RUN [Environment]::SetEnvironmentVariable('DOCKER_BUILD_DATE', $(Get-Date), 'Machine'); \ + $env:DOCKER_BUILD_DATE = [System.Environment]::GetEnvironmentVariable('DOCKER_BUILD_DATE','Machine'); + +RUN Write-Host '=============================================='; \ + Write-Host 'Performing Storj Labs storjshare-daemon Image Build'; \ + Write-Host 'Github Site: https://github.com/Storj/storjshare-daemon'; \ + Write-Host ''; \ + Write-Host ('Docker Image Build Date: {0}' -f $env:DOCKER_BUILD_DATE); \ + Write-Host ''; \ + Write-Host 'Loading Recommended Versions of Software'; \ + Write-Host ('Node.js: {0}' -f $env:NODE_VERSION); \ + Write-Host ('MinGit: {0}' -f $env:MINGIT_VERSION); \ + Write-Host ''; \ + Write-Host 'Loading Storj Labs Tools'; \ + Write-Host ('windows-build-tools: Latest Version'); \ + Write-Host ('storjshare-daemon: Latest Version'); \ + Write-Host '=============================================='; + +#node.js Setup +RUN Write-Host ('Downloading node.js {0} ...' -f $env:NODE_VERSION); \ + Invoke-WebRequest $('https://nodejs.org/dist/v{0}/node-v{0}-win-x64.zip' -f $env:NODE_VERSION) -OutFile 'node.zip' -UseBasicParsing ; \ + \ + Write-Host 'Extracting node.js ...'; \ + Expand-Archive node.zip -DestinationPath C:\ ; \ + \ + Write-Host 'Extracting node.js and setting up C:\nodejs ...'; \ + Rename-Item -Path $('C:\node-v{0}-win-x64' -f $env:NODE_VERSION) -NewName 'C:\nodejs' ; \ + New-Item $($env:APPDATA + '\npm') ; \ + \ + Write-Host 'Adding npm to Environment Path'; \ + $env:PATH = 'C:\nodejs;{0}\npm;{1}' -f $env:APPDATA, $env:PATH ; \ + Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\' -Name Path -Value $env:PATH ; \ + \ + Write-Host 'Testing Node Install'; \ + Write-Host npm --version; npm --version; \ + \ + Write-Host 'Cleaning up'; \ + Remove-Item -Path node.zip; \ + \ + Write-Host 'Completed node.js Installation Successfully'; + +#MinGit Setup + +RUN Write-Host ('Downloading MinGit {0} ...' -f $env:MINGIT_VERSION); \ + Invoke-WebRequest $('https://github.com/git-for-windows/git/releases/download/v{0}.windows.1/MinGit-{0}-64-bit.zip' -f $env:MINGIT_VERSION) -OutFile 'mingit.zip' -UseBasicParsing ; \ + \ + Write-Host 'Extracting MinGit and setting up C:\mingit ...'; \ + Expand-Archive mingit.zip -DestinationPath C:\mingit ; \ + \ + Write-Host 'Adding git to Environment Path'; \ + $env:PATH = 'C:\mingit\cmd;{0}' -f $env:PATH ; \ + Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\' -Name Path -Value $env:PATH ; \ + \ + Write-Host 'Testing MinGit Install'; \ + Write-Host git version; git version; \ + \ + Write-Host 'Cleaning up'; \ + Remove-Item -Path mingit.zip; \ + \ + Write-Host 'Completed MinGit Installation Successfully'; + +#windows-build-tools Setup +RUN Write-Host ('Installing windows-build-tools - Latest Version'); \ + Write-Host npm install --global windows-build-tools; npm install --global windows-build-tools; \ + \ + Write-Host 'Completed Storj-cli Installation Successfully'; + +#storjshare-daemon Setup +RUN Write-Host ('Installing storjshare-daemon - Latest Version'); \ + Write-Host npm install --global storjshare-daemon; npm install --global storjshare-daemon; \ + \ + Write-Host 'Testing Storjshare-daemon Install'; \ + Write-Host storjshare --version; storjshare --version; \ + \ + Write-Host 'Completed storjshare-daemon Installation Successfully'; + +#Setting up MOTD +#ADD motd.txt motd.txt +#ADD Microsoft.PowerShell_profile.ps1 Microsoft.PowerShell_profile.ps1 + +#RUN New-item -type file -force $profile; \ +# Set-Content $Profile (Get-Content Microsoft.PowerShell_profile.ps1); \ +RUN Write-Host 'Cleaning up...'; \ + Remove-Item *.log -Force; \ + Remove-Item *.ps1 -Force; + +CMD [] +ENTRYPOINT ["powershell"]