Skip to content

Commit

Permalink
decred
Browse files Browse the repository at this point in the history
  • Loading branch information
JFixby committed Mar 8, 2019
1 parent 8474f13 commit a07e7ab
Show file tree
Hide file tree
Showing 14 changed files with 474 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*~
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
sudo: required
services:
- docker

script:
- docker build -t decred-golang-builder-1.10 -f Dockerfile-1.10 .
- docker build -t decred-golang-builder-1.11 -f Dockerfile-1.11 .
53 changes: 53 additions & 0 deletions Dockerfile-1.10
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#decred-golang-builder-1.10
# This image may be called with the run_tests.sh script included in any of the
# supported go repos.
# ./run_tests.sh 1.10

FROM golang:1.10.4

LABEL description="Decred golang builder image"
LABEL version="1.0"
LABEL maintainer "[email protected]"

ENV TERM linux
ENV USER build

# create user
RUN adduser --disabled-password --gecos '' $USER

# update base distro & install build tooling
ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update && \
apt-get install -qy rsync git xz-utils

# create directory for build artifacts, adjust user permissions
RUN mkdir /release && \
chown $USER /release

# create directory to get source from
RUN mkdir /src && \
chown $USER /src && \
mkdir -p /go/src/github.com/decred/dcrd && \
mkdir -p /go/src/github.com/decred/dcrwallet && \
chown -R $USER /go/src

# switch user
USER $USER
ENV HOME /home/$USER

#Get deps
ENV DEP_TAG v0.4.1
ENV GOMETALINTER_TAG v2.0.5

WORKDIR /go/src
RUN go get -u -v golang.org/x/vgo && \
go get -v github.com/alecthomas/gometalinter && \
cd /go/src/github.com/alecthomas/gometalinter && \
git checkout $GOMETALINTER_TAG && \
go install -i && \
gometalinter --install && \
go get -v github.com/golang/dep && \
cd /go/src/github.com/golang/dep && \
git checkout $DEP_TAG && \
go install -i ./...
55 changes: 55 additions & 0 deletions Dockerfile-1.11
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#decred-golang-builder-1.11
# This image may be called with the run_tests.sh script included in any of the
# supported go repos.
# ./run_tests.sh 1.11

FROM golang:1.11.5

LABEL description="Decred golang builder image"
LABEL version="1.1"
LABEL maintainer "[email protected]"

ENV TERM linux
ENV USER build

# create user
RUN adduser --disabled-password --gecos '' $USER

# update base distro & install build tooling
ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update && \
apt-get install -qy rsync git xz-utils

# create directory for build artifacts, adjust user permissions
RUN mkdir /release && \
chown $USER /release

# create directory to get source from
RUN mkdir /src && \
chown $USER /src && \
mkdir -p /go/src/github.com/decred && \
chown -R $USER /go/src

# switch user
USER $USER
ENV HOME /home/$USER

#Get deps
ENV DEP_TAG v0.4.1
ENV GOMETALINTER_TAG v2.0.5
ENV GOLANGCI_TAG v1.13.1

WORKDIR /go/src
RUN git clone --branch $GOLANGCI_TAG https://github.com/golangci/golangci-lint && \
cd golangci-lint/cmd/golangci-lint && \
GO111MODULE=on go install && \
go get -v github.com/alecthomas/gometalinter && \
cd /go/src/github.com/alecthomas/gometalinter && \
git checkout $GOMETALINTER_TAG && \
go install -i && \
gometalinter --install && \
go get -v github.com/golang/dep && \
cd /go/src/github.com/golang/dep && \
git checkout $DEP_TAG && \
go install -i ./...
66 changes: 66 additions & 0 deletions Dockerfile-dcrd
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#DOCKER_IMAGE_TAG=dcrd-mainnet
#mkdir .dcrd
#docker run -d --network=host -P -v $(pwd)/.dcrd/:/home/decred/.dcrd/ decred/$DOCKER_IMAGE_TAG

FROM ubuntu:xenial

LABEL description="Decred mainnet daemon"
LABEL version="1.3"
LABEL maintainer="[email protected]"

ENV DCR_RELEASE v1.2.0
ENV TERM linux
ENV USER decred
ENV HOME /home/$USER
ENV DOTDCRD $HOME/.dcrd

# create user
RUN adduser --disabled-password --gecos '' $USER

RUN set -x && \

# Update base distro & install build tooling
DEBIAN_FRONTEND=noninteractive && \
BUILD_DEPS=curl && \
apt-get update && \
apt-get install -qy $BUILD_DEPS && \

# Decred release url and files
DCR_RELEASE_URL="https://github.com/decred/decred-binaries/releases/download/$DCR_RELEASE" && \
DCR_MANIFEST_FILE="manifest-$DCR_RELEASE.txt" && \
DCR_RELEASE_NAME="decred-linux-amd64-$DCR_RELEASE" && \
DCR_RELEASE_FILE="$DCR_RELEASE_NAME.tar.gz" && \

# Import Decred gpg key
gpg --keyserver pgp.mit.edu --recv-keys 0x518A031D && \

# Download archives
cd /tmp && \
curl -SLO $DCR_RELEASE_URL/$DCR_RELEASE_FILE && \
curl -SLO $DCR_RELEASE_URL/$DCR_MANIFEST_FILE && \
curl -SLO $DCR_RELEASE_URL/$DCR_MANIFEST_FILE.asc && \

# Verify signature and hash
gpg --verify --trust-model=always $DCR_MANIFEST_FILE.asc && \
grep "$DCR_RELEASE_FILE" $DCR_MANIFEST_FILE | sha256sum -c - && \
rm -R $HOME/.gnupg && \

# Extract and install
tar xvzf $DCR_RELEASE_FILE && \
mv $DCR_RELEASE_NAME/dcrd $HOME && \
mkdir -p $DOTDCRD && \
chown -R $USER.$USER $HOME && \

# Cleanup
apt-get -qy remove $BUILD_DEPS && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# switch user for runtime
USER $USER
WORKDIR /home/$USER

# PEER & RPC PORTS
EXPOSE 9108 9109

CMD ./dcrd
11 changes: 11 additions & 0 deletions Dockerfile-dcrd-insight
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#DOCKER_IMAGE_TAG=dcrd-mainnet-insight
#mkdir .dcrd
#docker run -d --network=host -P -v $(pwd)/.dcrd/:/home/decred/.dcrd/ decred/$DOCKER_IMAGE_TAG

FROM decred/dcrd-mainnet

LABEL description="Decred mainnet daemon (insight options)"
LABEL version="1.0"
LABEL maintainer "[email protected]"

CMD ./dcrd -u user -P pass --notls --txindex --listen=127.0.0.1
16 changes: 16 additions & 0 deletions Dockerfile-dcrd-testnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#DOCKER_IMAGE_TAG=dcrd-testnet
#mkdir .dcrd
#docker run -d --network=host -P -v $(pwd)/.dcrd/:/home/decred/.dcrd/ decred/$DOCKER_IMAGE_TAG

FROM decred/dcrd-mainnet

LABEL description="Decred testnet daemon"
LABEL version="1.0"
LABEL maintainer "[email protected]"

# PEER PORT
EXPOSE 19108
# RPC PORT
EXPOSE 19109

CMD ./dcrd --testnet
11 changes: 11 additions & 0 deletions Dockerfile-dcrd-testnet-insight
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#DOCKER_IMAGE_TAG=dcrd-testnet-insight
#mkdir .dcrd
#docker run -d --network=host -P -v $(pwd)/.dcrd/:/home/decred/.dcrd/ decred/$DOCKER_IMAGE_TAG

FROM decred/dcrd-mainnet

LABEL description="Decred testnet daemon (insight options)"
LABEL version="1.0"
LABEL maintainer "[email protected]"

CMD ./dcrd --testnet -u user -P pass --notls --txindex --listen=127.0.0.1
61 changes: 61 additions & 0 deletions Dockerfile-dcrdata-builder
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#DOCKER_IMAGE_TAG=dcrdata-golang-builder-1.11
# This image may be used to build and test dcrdata with run_tests.sh:
# ./run_tests.sh 1.11

FROM golang:1.11.5

LABEL description="Decred dcrdata builder image"
LABEL version="1.0"
LABEL maintainer "[email protected]"

ENV TERM linux
ENV USER build

# create user
RUN adduser --disabled-password --gecos '' $USER

# update base distro & install build tooling
ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update && apt-get install -qy apt-transport-https ca-certificates

ENV NODE_VERSION node_11.x

RUN curl -sSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - && \
DISTRO=`grep VERSION= /etc/os-release | awk -F"[()]" '{print $2}'` && \
echo "deb https://deb.nodesource.com/$NODE_VERSION $DISTRO main" | tee /etc/apt/sources.list.d/nodesource.list && \
echo "deb-src https://deb.nodesource.com/$NODE_VERSION $DISTRO main" | tee -a /etc/apt/sources.list.d/nodesource.list

RUN apt-get update && \
apt-get install -qy rsync git xz-utils apt-utils nodejs && \
echo Node.js: `node --version`

RUN npm install stylelint stylelint-config-standard eslint -g

# create directory for build artifacts, adjust user permissions
RUN mkdir /release && \
chown $USER /release

# create directory to get source from
RUN mkdir /src && \
chown $USER /src && \
mkdir -p /go/src/github.com/decred && \
chown -R $USER /go/src

# switch user
USER $USER
ENV HOME /home/$USER

# Install linters
ENV GOMETALINTER_TAG v2.0.5
ENV GOLANGCI_TAG v1.13.1

WORKDIR /go/src
RUN git clone --branch $GOLANGCI_TAG https://github.com/golangci/golangci-lint && \
cd golangci-lint/cmd/golangci-lint && \
GO111MODULE=on go install && \
go get -v github.com/alecthomas/gometalinter && \
cd /go/src/github.com/alecthomas/gometalinter && \
git checkout $GOMETALINTER_TAG && \
go install -i && \
gometalinter --install
45 changes: 45 additions & 0 deletions Dockerfile-decrediton
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#decrediton-builder
# This image should be called from the script build-docker.sh in the
# decred/decrediton repo.
# ./build-docker.sh

FROM ubuntu:trusty

LABEL description="Decrediton builder image"
LABEL version="1.2"
LABEL maintainer "[email protected]"

ENV NODE_VERSION v6.9.5
ENV TERM linux
ENV USER build

# create user
RUN adduser --disabled-password --gecos '' $USER

# update base distro & install build tooling
ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update && \
apt-get install -qy build-essential python git curl rpm

# create directory for build artifacts, adjust user permissions
RUN mkdir /release && \
chown $USER /release

# create directory to get source from
RUN mkdir /src && \
chown $USER /src

# switch user
USER $USER
WORKDIR /home/$USER
ENV HOME /home/$USER
ENV NVM_DIR $HOME/.nvm

# install & configure NodeJS
RUN curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bash && \
. $NVM_DIR/nvm.sh && \
nvm install $NODE_VERSION && \
nvm use $NODE_VERSION && \
npm set progress=false; npm set cache-min 999999999

56 changes: 56 additions & 0 deletions Dockerfile-insight
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#DOCKER_IMAGE_TAG=decred-insight
#mkdir -p .insight
#docker run -d --network=host -P -v $(pwd)/.insight/:/home/insight/.insight/ decred/$DOCKER_IMAGE_TAG

FROM debian:sid

LABEL description="Decrediton insight image"
LABEL version="1.0"
LABEL maintainer "[email protected]"

ENV NODE_VERSION v0.10.40
ENV INSIGHT_COMMIT=739eb5e5d33bf2a491e1d346cb8430bd2540eba2

ENV TERM linux
ENV USER insight

# create user
RUN adduser --disabled-password --gecos '' $USER

# update base distro & install build tooling
ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update && \
apt-get install -qy build-essential python git curl

# switch user
USER $USER
WORKDIR /home/$USER
ENV HOME /home/$USER
ENV NVM_DIR $HOME/.nvm

# install nodejs
RUN git clone https://github.com/creationix/nvm.git ~/.nvm && cd ~/.nvm && git checkout `git describe --abbrev=0 --tags` && \
. ~/.nvm/nvm.sh && \
nvm install $NODE_VERSION && \
nvm use $NODE_VERSION

RUN echo '. $HOME/.nvm/nvm.sh' >> ~/.bashrc

# install insight
RUN git clone https://github.com/decred/insight.git && \
cd insight && \
git checkout $INSIGHT_COMMIT && \
. ~/.nvm/nvm.sh && \
npm install

WORKDIR insight

EXPOSE 3003

ENV BITCOIND_USER user
ENV BITCOIND_PASS pass
ENV INSIGHT_NETWORK dcrdlivenet
ENV LOGGER_LEVEL error

CMD . ~/.nvm/nvm.sh && npm start
Loading

0 comments on commit a07e7ab

Please sign in to comment.