Skip to content

Instantly share code, notes, and snippets.

@bryanhuntesl
Last active December 5, 2017 19:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bryanhuntesl/cc0eefa6939b757ca7b86ebb1d7b29b2 to your computer and use it in GitHub Desktop.
Save bryanhuntesl/cc0eefa6939b757ca7b86ebb1d7b29b2 to your computer and use it in GitHub Desktop.

Build the latest Riak (2.2.4) using Docker for RHEL/Centos 6

The following instructions can be used to build the latest Riak version using Docker

Create a file, 'Dockerfile` containing the following content:


FROM centos:centos6 AS centos_centos6_rpm_builder

RUN yum -y install epel-release deltarpm

RUN yum -y install java-1.7.0-openjdk wget git make which gcc gcc-c++ pam-devel rpm-build https://packages.erlang-solutions.com/erlang/esl-erlang/FLAVOUR_1_general/esl-erlang_16.b.2.basho10-2~centos~6_amd64.rpm
  
WORKDIR /root/

RUN git config --global url."https://github.com/".insteadOf git@github.com: && git config --global url."https://".insteadOf git:// 

ARG riak_ver="riak-2.2.3"

RUN git clone git@github.com:basho/riak.git

RUN cd riak && git checkout $riak_ver

WORKDIR /root/riak

RUN make package

FROM centos:centos6

EXPOSE 8087 8098

MAINTAINER Bryan Hunt <admin@binarytemple.co.uk>

ARG riak_ver="riak-2.2.3"

WORKDIR /root/

RUN yum -y install epel-release

COPY --from=centos_centos6_rpm_builder /root/riak/distdir/packages/${riak_ver}-1.el6.x86_64.rpm .

RUN yum -y install ${riak_ver}-1.el6.x86_64.rpm

CMD cp ./*.rpm /target

Then run the following commands in the same directory:

export DIST="riak-centos-6" 
export VER=2.2.4
docker build -t "${DIST}:${VER}" --build-arg riak_ver="riak-${VER}" .                                                                                                                                       
docker run -v $(pwd):/target "${DIST}:${VER}"    

The generated rpm files will be deposited into the working directory.

From there, you can install the packages as usual using the yum command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment