BitShares Forum

Main => General Discussion => Topic started by: cryptosile on July 27, 2015, 10:33:43 pm

Title: Docker build box
Post by: cryptosile on July 27, 2015, 10:33:43 pm
Update: 8/2/2015
I added a script for easier use, moved the build files outside the container, and made the container smaller.
The original example will still work but a new easier method is now available:

docker run -v <local host path for build>:/build sile16/graphene-build [optional tag or commit sha]

Example:
[Install docker on ubuntu, sudo apt-get install docker]
sudo docker run -v /home/sile:/build sile16/graphene-build
this builds the latest master into -> /home/sile/graphene

now... I think i'm close to where I can automate the creation of runtime docker containers with just binaries...  to be continued..

=========  Original Post  ===========================
I was wanting to learn docker so I thought I'd make a build box for graphene:

Docker Image on Docker Hub:
sile16/graphene-build

The image gets everything installed right before you download graphene and compile.

Now if you want to compile graphene you can use the following docker file:

Dockerfile:
Code: [Select]
FROM sile16/graphene-build:pre

# Install Graphene
RUN cd && git clone https://github.com/cryptonomex/graphene.git
WORKDIR /root/graphene
RUN git submodule update --init --recursive
RUN cmake -DBOOST_ROOT="/usr/local/" -DCMAKE_BUILD_TYPE=Debug -DENABLE_COVERAGE_TESTING=true -DBUILD_TESTS=true .
RUN make -j4

Actually do the build
Code: [Select]
#docker build -t build01 .
Start a shell inside the docker container to run tests / use graphene , etc
Code: [Select]
#docker run -it build01 /bin/bash


Here is the docker file i used to create sile16/graphene-build

My Dockerfile:
Code: [Select]
FROM ubuntu:14.04

# Prep Server
RUN apt-get update

# Install Prerequisite Packages
RUN apt-get -y install git libreadline-dev uuid-dev g++ libdb++-dev libdb-dev zip
RUN apt-get -y install libssl-dev openssl build-essential python-dev autotools-dev libicu-dev
RUN apt-get -y install libbz2-dev automake doxygen cmake ncurses-dev libtool nodejs nodejs-legacy npm mc
RUN apt-get -y install autoconf wget
RUN apt-get -y autoremove

# Install Boost 1.57
WORKDIR /tmp
RUN wget -c 'http://sourceforge.net/projects/boost/files/boost/1.57.0/boost_1_57_0.tar.bz2/download'
RUN tar -xf download
WORKDIR /tmp/boost_1_57_0
RUN ./bootstrap.sh --prefix=/usr/local/
RUN ./b2 install

#Cleanup Boost Install
WORKDIR /root/
RUN rm -rf /tmp/boost_1_57_0
RUN rm -f /tmp/download

if there are ways to make this better please let me know.  I'm definitely not an expert in this stuff just dabbling.
Title: Re: Docker build box
Post by: xeroc on July 28, 2015, 06:54:06 am
Very cool .. +5%
Title: Re: Docker build box
Post by: cass on July 28, 2015, 08:12:42 am
 +5%