Giter VIP home page Giter VIP logo

dcrdocker's Introduction

dcrdocker

Dockerfiles for Decred.

General info

This repository contains a number of docker files used by decred for various purposes.

The main goal is to keep the images simple and understandable. Although we would like to keep images small when possible, simplicity/readability is to be preferred over size in all cases. For example, this means it is better to use env variables for settings to be in one place even if it requires more than one RUN directive in the Dockerfile. Whenever possible images should import from each other so we have as close to a known base as possible. When possible, the images strive to be self-contained with as much data as possible set at build time (and persistent data mounted from host only).

Available Images

The table below gives link to all images but a brief description is useful first. There is a mainnet and testnet dcrd image with no special settings (these can be set with a local dcrd.conf file). There are also images based on those that have the settings needed for insight already included. Mainnet and a testnet insight images are provided and are meant to be run on the same machine as the dcrd image they use for blockchain data.

Images for running a full build and test of dcrd, dcrwallet, or any of the go projects are provided. These are generally run in travis but this way the setup can be run identically locally and from travis. Unlike the other images which are based on a recent Ubuntu, these are based on the official go images. They must be modified if a new minor version of go is needed and a new one added for a new major version. Both operations are described below.

The decrediton builder image allows us to check the build and lint in travis and allows for an easy build during development although we do not use the artifacts it creates for releases. It would be a nice improvement if the node/npm dependencies could be included in the built image (would speed up builds and make them more reproducible). It is possible something like npm-cache-install could be useful there.

Dockerfile Image Name Link Description pull command
Dockerfile-dcrd dcrd-mainnet docker hub Mainnet dcrd. docker pull decred/dcrd-mainnet
Dockerfile-dcrd-testnet dcrd-testnet docker hub Testnet dcrd. docker pull decred/dcrd-testnet
Dockerfile-dcrd-insight dcrd-mainnet-insight docker hub Mainnet dcrd for insight use. docker pull decred/dcrd-mainnet-insight
Dockerfile-dcrd-testnet-insight dcrd-testnet-insight docker hub Testnet dcrd for insight use. docker pull decred/dcrd-testnet-insight
Dockerfile-insight decred-insight docker hub Decred insight on mainnet. docker pull decred/decred-insight
Dockerfile-insight-testnet decred-insight-testnet docker hub Decred insight on testnet. docker pull decred/decred-insight-testnet
Dockerfile-1.11 decred-golang-builder-1.11 docker hub Build/test with go1.11. docker pull decred/decred-golang-builder-1.11
Dockerfile-1.12 decred-golang-builder-1.12 docker hub Build/test with go1.12. docker pull decred/decred-golang-builder-1.12
Dockerfile-decrediton decrediton-builder docker hub Builder image for decrediton docker pull decred/decrediton-builder

Building images

The images are built and pushed to the docker hub repo as follows (the names can be taken from the table above):

DOCKER_IMAGE_TAG=dcrd-mainnet
docker build -t $DOCKER_IMAGE_TAG -f Dockerfile-dcrd .
docker tag $DOCKER_IMAGE_TAG decred/$DOCKER_IMAGE_TAG
docker push decred/$DOCKER_IMAGE_TAG

Using the images

All of the images have usage instructions at the top of the dockerfile. Just pull the image:

docker pull decred/$DOCKER_IMAGE_TAG

then follow the instructions in the dockerfile. When necessary, a script to run it is included in the repo where it is needed.

Updating docker go versions

When a new minor version of go is released, the docker images must be updated and rebuilt to support it. For example, when go1.8.3 was released, the file Dockerfile-1.8 was edited by changing FROM golang:1.8.2 to FROM golang:1.8.3. Then the image was rebuilt and pushed to docker hub:

GOVERSION=1.8
DOCKER_IMAGE_TAG=decred-golang-builder-$GOVERSION
docker build -t $DOCKER_IMAGE_TAG -f ./Dockerfile-$GOVERSION .

For a new major version, a new file Dockerfile-VERSION must be created and then the previous steps can be followed. That new version must be added to the travis build matrix to run the tests in travis.

dcrdocker's People

Contributors

alexlyp avatar chappjc avatar dajohi avatar jcvernaleo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dcrdocker's Issues

utilities are not present in dcrd images

When I build the dcrd from source I get a few more binaries.

-rwxr-xr-x    1 decred   decred    10191247 Aug 23 22:30 addblock
-rwxr-xr-x    1 decred   decred    11210318 Aug 23 22:30 dcrctl
-rwxr-xr-x    1 decred   decred    18829982 Aug 23 22:31 dcrd
-rwxr-xr-x    1 decred   decred     9961906 Aug 23 22:30 findcheckpoint
-rwxr-xr-x    1 decred   decred     4697431 Aug 23 22:30 gencerts
-rwxr-xr-x    1 decred   decred     1979881 Aug 23 22:30 promptsecret

However, in the image only the dcrd binary exist.

decred@c8784b9f758a:~$ pwd
/home/decred
decred@c8784b9f758a:~$ ls -l
total 19064
-rwxr-xr-x 1 decred decred 19518723 Apr 25 20:02 dcrd

Trying to make an alpine image

I am trying to create a more lightweight version of decred using alpine instead of ubuntu.

To simplify getting it to work, I have this Dockerfile

FROM alpine:3.6

RUN apk update \
    && apk add libc6-compat curl \
    && curl -LO https://github.com/decred/decred-binaries/releases/download/v1.0.5/decred-linux-amd64-v1.0.5.tar.gz \
    && tar xzf decred-linux-amd64-v1.0.5.tar.gz

The libc6-compat library is needed because I will get an No such file or directory when trying to execute decred binaries without (because of missing /lib64/ld-linux-x86-64.so.2, see readelf -a dcrwallet | grep "Requesting program interpreter").

Now I am getting this error:

Error relocating ./dcrwallet: __vfprintf_chk: symbol not found
Error relocating ./dcrwallet: __fprintf_chk: symbol not found

which I think is some missing flags during the compilation.

Is there any hope getting this worked out without having to make an alpine image that compiles it all from scratch?

The absolute best and most secure docker image would be using the scratch base image. Something like https://blog.codeship.com/building-minimal-docker-containers-for-go-applications/, but changing from ubuntu to alpine is also good..

Install golangci-lint in docker build image

RUN go get -v github.com/alecthomas/gometalinter && \

dcrdata is switching to golangci-lint instead of gometalinter. With modules golangci-lint appears to work correctly.

The snippet I'm currently using in dcrdata's run_test.sh file is:

git clone --branch v1.12.3 https://github.com/golangci/golangci-lint ~/golangci-lint
pushd ~/golangci-lint/cmd/golangci-lint
go install
popd

I am using it as follows:

golangci-lint run --deadline=10m --disable-all --enable govet --enable staticcheck \
  --enable gosimple --enable unconvert --enable ineffassign --enable structcheck \
  --enable goimports --enable misspell --enable unparam
if [ $? != 0 ]; then	
  echo 'golangci-lint has some complaints'	
  exit 1	
fi

There seems to be no need to install individual linters.

Cannot run decred-insight after rebuild images

I build a docker image locally by this Dockerfile Dockerfile-insight , then I run a container by this images I just built, error occured as following:

> [email protected] start /home/insight/insight
> INSIGHT_FORCE_RPC_SYNC=1 INSIGHT_PUBLIC_PATH=public node node_modules/.bin/insight-bitcore-api


/home/insight/insight/node_modules/insight-bitcore-api/node_modules/winston/lib/winston.js:10
const logform = require('logform');
^^^^^
SyntaxError: Use of const in strict mode.
    at Module._compile (module.js:439:25)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/home/insight/insight/node_modules/insight-bitcore-api/lib/logger.js:1:77)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)

npm ERR! [email protected] start: `INSIGHT_FORCE_RPC_SYNC=1 INSIGHT_PUBLIC_PATH=public node node_modules/.bin/insight-bitcore-api`
npm ERR! Exit status 8
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is most likely a problem with the insight-bitcore package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     INSIGHT_FORCE_RPC_SYNC=1 INSIGHT_PUBLIC_PATH=public node node_modules/.bin/insight-bitcore-api
npm ERR! You can get their info via:
npm ERR!     npm owner ls insight-bitcore
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 4.9.87-linuxkit-aufs
npm ERR! command "/home/insight/.nvm/v0.10.40/bin/node" "/home/insight/.nvm/v0.10.40/bin/npm" "start"
npm ERR! cwd /home/insight/insight
npm ERR! node -v v0.10.40
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     /home/insight/insight/npm-debug.log
npm ERR! not ok code 0

While,I can run container by official image decred/decred-insight. So my question is: Does the decred/decred-insight image built from this Dockerfile? Or, maybe this Dockerfile is sth wrong?

add curl to images

I am creating some docker-compose files for dcrdata and need the validate that dcrd is up and running through a healthcheck. However, there is no curl command. Please add the curl package to the list of packages during a build.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.