Skip to content
This repository was archived by the owner on Jan 3, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ before_script:
script:
- pylint $TRAVIS_BUILD_DIR/docker/vcf_combiner/usr/bin/combine_vcf.py
- pytest $TRAVIS_BUILD_DIR/docker/vcf_combiner/usr/bin/combine_vcf.py
- bash -n $TRAVIS_BUILD_DIR/docker/genomicsdb_builder/usr/bin/build_genomicsdb
- cd $GENOMICSDB_BUILD_DIR
- cmake $TRAVIS_BUILD_DIR -DBUILD_JAVA=1 -DCMAKE_BUILD_TYPE=Coverage -DCMAKE_INSTALL_PREFIX=$GENOMICSDB_INSTALL_DIR -DLIBCSV_DIR=$TRAVIS_BUILD_DIR/dependencies/libcsv -DGENOMICSDB_RELEASE_VERSION=$GENOMICSDB_RELEASE_VERSION -DMAVEN_QUIET=True
- ln -s $TRAVIS_BUILD_DIR/tests
Expand Down
2 changes: 2 additions & 0 deletions docker/genomicsdb_builder/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# no build
/build_src/
45 changes: 45 additions & 0 deletions docker/genomicsdb_builder/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# The MIT License (MIT)
# Copyright (c) 2016-2017 Intel Corporation
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
# the Software, and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# The code utilized some features of RedHat pre-built container

FROM centos:7

LABEL vendor="Intel Inc." name="GenomicsDB Builder" version="1.0" description="Build GenomicsDB"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intel Corporation


RUN yum install -y --setopt=tsflags=nodocs centos-release-scl && \
yum-config-manager --enable rhel-server-rhscl-7-rpms && \
yum install -y devtoolset-4 && \
yum install -y --setopt=tsflags=nodocs epel-release && \
yum repolist && \
yum install -y --setopt=tsflags=nodocs cmake git.x86_64 libcsv libcsv-devel mpich-devel openssl-devel zlib-devel unzip.x86_64 && \
yum install -y python34.x86_64 && \
yum clean all

ENV BASH_ENV=/etc/profile.d/cont-env.sh PATH=$PATH:/usr/lib64/mpich/bin HOME=/home/default

WORKDIR /home/default

ADD ./usr /usr
ADD ./etc /etc
ADD ./root /root

ENTRYPOINT ["/usr/bin/container-entrypoint"]
CMD ["build_genomicsdb"]
23 changes: 23 additions & 0 deletions docker/genomicsdb_builder/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
### GenomicsDB Building Docker

The centos-build is the source code for building a GenomicsDB building environment Docker image. The details about GenomicsDB building environment can be found at [GenomicsDB Wiki]( https://github.com/Intel-HLS/GenomicsDB/wiki/Compiling-GenomicsDB#building.)

To create a GenomicsDB building environment Docker image, run the following command:

<code>docker build -t name_of_the_builder_image --no-cache .</code>

Once the image is created. You can build the latest GenomicsDB executables by running:

<code>docker run -it -v /path/2/output/:/output/ [-e GDB_BRANCH=branch_name_default_is_master] name_of_the_builder_image</code>

In this case, the docker container builds GenomicsDB with the following options:

* CMAKE_BUILD_TYPE=Release
* DO_PROFILING=False
* DISABLE_OPENMP=True
* BUILD_JAVA=False
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why disable OpenMP and Java?

* DO_PROFILING=False
* CMAKE_INSTALL_PREFIX=/output/
* PROTOBUF_LIBRARY=dont_worry_the_docker_manage_it

You can pass GenomicsDB building options via docker run command arguments. The docker will pass your arguments to cmake. Since the docker builds protobuf library internally, you just ignore the PROTOBUF_LIBRARY option.
1 change: 1 addition & 0 deletions docker/genomicsdb_builder/etc/profile.d/cont-env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
source /usr/share/cont-lib/cont-env.sh
1 change: 1 addition & 0 deletions docker/genomicsdb_builder/root/.bashrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
source /usr/share/cont-lib/cont-env.sh
99 changes: 99 additions & 0 deletions docker/genomicsdb_builder/usr/bin/build_genomicsdb
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
#! /bin/bash
# The MIT License (MIT)
# Copyright (c) 2017 Intel Corporation
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2016-2017

#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
# the Software, and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

if [ ! -d /output ]; then
echo 'can not find /output/ exit...'
return 2
fi
export BUILD_ROOT=${HOME}/build_src
export PROTOBUF_LIBRARY=$BUILD_ROOT/protobuf_build
echo "build_home=$build_home, PROTOBUF_LIBRARY=$PROTOBUF_LIBRARY, GenomicsDB_HOME=$GenomicsDB_HOME"

protobuf_to_dir=/output
genomicsdb_to_dir=/output

# make protobuf
build_proto_buf() {
echo "+++ Building protobuf at ${PROTOBUF_LIBRARY}..."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the message is wrong. you're not building protobuf under $BUILD_ROOT/protobuf_build, you're building it under /output

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you did not use PROTOBUF_LIBRARY actually in the cmake

mkdir -p /output/protobuf
mkdir -p ${PROTOBUF_LIBRARY} && pushd ${PROTOBUF_LIBRARY} >/dev/null 2>&1
git clone https://github.com/google/protobuf.git
cd protobuf
git checkout 3.0.x
./autogen.sh
./configure --prefix=$protobuf_to_dir --with-pic
if [ -f ./Makefile ]; then
make && make install
basename $(ls $protobuf_to_dir/bin/protoc)
find $protobuf_to_dir/lib/ -name 'libproto*' -type f -exec basename {} \;
echo "--- Done building protobuf"
popd >/dev/null 2>&1
return 0
else
popd >/dev/null 2>&1
echo "ERROR: build_proto_buf not find Makefile"
return -1
fi
}

# make genomicsdb
build_gdb() {
echo
echo "+++ Building GenomicsDB at ${GenomicsDB_HOME}..."
git clone --recursive https://github.com/Intel-HLS/GenomicsDB.git
ws=GenomicsDB/build
mkdir -p $ws && pushd $ws >/dev/null 2>&1
branch=${GDB_BRANCH:=master}
git checkout $branch
git branch
if [ $# -gt 0 ]; then
cmake --warn-uninitialized --debug-output .. -DCMAKE_INSTALL_PREFIX=$genomicsdb_to_dir -DPROTOBUF_LIBRARY=$protobuf_to_dir $@
else
cmake --warn-uninitialized --debug-output .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$genomicsdb_to_dir -DDO_PROFILING=False -DPROTOBUF_LIBRARY=$protobuf_to_dir -DDISABLE_OPENMP=True -DBUILD_JAVA=False -DDO_PROFILING=False
fi

if [ -f ./Makefile ]; then
make && make install
echo "INFO: Successfully built GenomicsDB... run test"
../tests/run.py $PWD $genomicsdb_to_dir
popd >/dev/null 2>&1
return 0
else
echo "ERROR: build_gdb not find Makefile"
popd >/dev/null 2>&1
return -1
fi
}

#source /opt/rh/devtoolset-4/enable
gcc --version

mkdir -p ${BUILD_ROOT} && pushd ${BUILD_ROOT} >/dev/null 2>&1
build_proto_buf
retst=$?
if [ $retst -eq 0 ]; then
build_gdb $@
retst=$?
rsync -az $genomicsdb_to_dir /usr
fi
[[ $retst -eq 0 ]] && echo "DONE: built GenomicsDB" || echo "FAIL: cannot build GenomicsDB"
popd >/dev/null 2>&1
return $retst
10 changes: 10 additions & 0 deletions docker/genomicsdb_builder/usr/bin/container-entrypoint
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

. /usr/share/cont-lib/cont-lib.sh

cont_debug "command: $*"

__cont_source_scripts "/usr/share/cont-entry"

test -z "$*" && set -- bash
exec "$@"
6 changes: 6 additions & 0 deletions docker/genomicsdb_builder/usr/bin/container-usage
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

# TODO: support API for executable help scripts
cat /usr/share/cont-docs/*.txt 2>/dev/null


20 changes: 20 additions & 0 deletions docker/genomicsdb_builder/usr/share/cont-docs/70-general.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
General container help
----------------------

Run `docker run THIS_IMAGE container-usage` to get this help.

Run `docker run -ti THIS_IMAGE bash` to obtain interactive shell.

Run `docker exec -ti CONTAINERID container-entrypoint` to access already running container.

In order to get the container ID after running the image, pass `--cidfile=`
option to the `docker run` command. That will instruct Docker to write
a file with the container ID.

You may try `-e CONT_DEBUG=VAL` with VAL up to 3 to get more verbose debugging
info.


Report bugs to <http://bugzilla.redhat.com>.


1 change: 1 addition & 0 deletions docker/genomicsdb_builder/usr/share/cont-docs/README
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Files '*.txt' are automatically read and added to 'container-usage' output.
1 change: 1 addition & 0 deletions docker/genomicsdb_builder/usr/share/cont-entry/cont-env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
source /usr/share/cont-lib/cont-env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
# M:R: this file was part of Red Hat samples
source scl_source enable devtoolset-4
2 changes: 2 additions & 0 deletions docker/genomicsdb_builder/usr/share/cont-lib/autoload/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
All '*.sh' files in this directory will be automatically sourced together with
cont-lib.sh script.
6 changes: 6 additions & 0 deletions docker/genomicsdb_builder/usr/share/cont-lib/cont-env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
. /usr/share/cont-lib/cont-lib.sh

cont_debug "changing environment variables"

cont_source_hooks env common

97 changes: 97 additions & 0 deletions docker/genomicsdb_builder/usr/share/cont-lib/cont-lib.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
__cont_source_scripts()
{
local i
local dir="$1"
for i in "$dir"/*.sh; do
if test -r "$i"; then
. "$i"
fi
done
}


# CONT_SOURCE_HOOKS HOOKDIR [PROJECT]
# -----------------------------------
# Source '*.sh' files from the following directories (in this order):
# a. /usr/share/cont-layer/PROJECT/HOOK/
# b. /usr/share/cont-volume/PROJECT/HOOK/
#
# The PROJECT argument is optional because it may be set globally by
# $CONT_PROJECT environment variable. The need for PROJECT argument is
# basically to push people to install script into theirs own directories,
# which will allow easier multi-project containers maintenance.
cont_source_hooks()
{
local i dir
local hook="$1"
local project="$CONT_PROJECT"
local dir

test -z "$hook" && return
test -n "$2" && project="$2"

for dir in /usr/share/cont-layer /usr/share/cont-volume; do
dir="$dir/$project/$hook"
cont_debug2 "loading scripts from $dir"
__cont_source_scripts "$dir"
done
}

__cont_msg()
{
echo "$*" >&2
}


__cont_dbg()
{
test -z "$CONT_DEBUG" && CONT_DEBUG=0
test "$CONT_DEBUG" -lt "$1" && return
local lvl="$1"
shift
__cont_msg "debug_$lvl: $*"
}


cont_warn() { __cont_msg "warn: $*" ; }
cont_error() { __cont_msg "error: $*"; }
cont_debug() { __cont_dbg 1 "$*" ; }
cont_debug2() { __cont_dbg 2 "$*" ; }
cont_debug3() { __cont_dbg 3 "$*" ; }


__cont_encode_env()
{
local i
for i in $1
do
eval local val="\$$i"
printf ": \${%s=%q}\n" "$i" "$val"
done
}


# CONT_STORE_ENV VARIABLES FILENAME
# ---------------------------------
# Create source-able script conditionally setting specified VARIABLES by
# inheritting the values from current environment; Create the file on path
# FILENAME. Already existing variables will not be changed by sourcing the
# resulting script. The argument VARIABLES expects list of space separated
# variable names.
#
# Usage:
# $ my_var=my_value
# $ my_var2="my value2"
# $ cont_store_env "my_var my_var2" ~/.my-environment
# $ cat ~/.my-environment
# : ${my_var=my_value}
# : ${my_var2=my\ value2}
cont_store_env()
{
cont_debug "creating env file '$2'"
__cont_encode_env "$1" > "$2" \
|| cont_warn "can't store environment $1 into $2 file"
}


__cont_source_scripts "/usr/share/cont-lib/autoload"
Loading