Skip to content

Commit

Permalink
Merge branch 'release/4.1.0'
Browse files Browse the repository at this point in the history
Release with Docker files to build a container
  • Loading branch information
Raul Alcantara committed Sep 9, 2019
2 parents 133075f + 2bc0887 commit a574fed
Show file tree
Hide file tree
Showing 8 changed files with 275 additions and 24 deletions.
32 changes: 10 additions & 22 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,17 @@ notifications:
slack: wtsi-cgpit:ptUMR1tkNyZJYd9TpGoss8WR
email: false

env:
- CC=gcc
sudo: false

addons:
apt:
packages:
- build-essential
- autoconf
- curl
- zlib1g-dev
- libncurses5-dev
- libpstreams-dev
- libcurl4-openssl-dev
language: ruby

install: true

language: perl

perl:
- "5.22"
# - "5.16"
services:
- docker

script:
- ./setup.sh $HOME/wtsi-opt
- ls -l $HOME/wtsi-opt/bin/alleleCounter
- ls -l $HOME/wtsi-opt/bin/alleleCounter.pl
- echo 'Build and check docker image'
- docker build -t allelec .
- docker images | grep -c allelec
- echo 'Verify program(s) from this repo'
- docker run -t --rm allelec alleleCounter -v
- docker run -t --rm allelec alleleCounter.pl -v
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGES

## v4.1.0

* Created Docker file and build scripts to generate a containeraized code

## v4.0.2

* Added checking of iterator error codes when calling sam_itr_next
Expand Down
94 changes: 94 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
FROM ubuntu:16.04 as builder

USER root

# ALL tool versions used by opt-build.sh
ENV VER_HTSLIB="1.7"

RUN apt-get -yq update
RUN apt-get install -yq --no-install-recommends \
build-essential \
apt-transport-https \
curl \
ca-certificates \
make \
bzip2 \
gcc \
locales \
curl \
wget \
libtasn1-dev \
libgnutls-dev \
nettle-dev \
libgmp-dev \
libp11-kit-dev \
zlib1g-dev \
libbz2-dev \
liblzma-dev \
libcurl4-gnutls-dev \
libncurses5-dev

RUN locale-gen en_US.UTF-8
RUN update-locale LANG=en_US.UTF-8

ENV OPT /opt/wtsi-cgp
ENV PATH $OPT/bin:$OPT/biobambam2/bin:$PATH
ENV PERL5LIB $OPT/lib/perl5
ENV LD_LIBRARY_PATH $OPT/lib
ENV LC_ALL en_US.UTF-8
ENV LANG en_US.UTF-8

# build tools from other repos
ADD build/opt-build.sh build/
RUN bash build/opt-build.sh $OPT

# build the tools in this repo, separate to reduce build time on errors
COPY . .
RUN bash build/opt-build-local.sh $OPT

FROM ubuntu:16.04

LABEL maintainer="cgphelp@sanger.ac.uk" \
uk.ac.sanger.cgp="Cancer, Ageing and Somatic Mutation, Wellcome Trust Sanger Institute" \
version="v1.0.0" \
description="alleleCount docker"

RUN apt-get -yq update
RUN apt-get install -yq --no-install-recommends \
apt-transport-https \
locales \
curl \
ca-certificates \
libperlio-gzip-perl \
bzip2 \
psmisc \
time \
zlib1g \
liblzma5 \
libncurses5 \
p11-kit \
unattended-upgrades && \
unattended-upgrade -d -v && \
apt-get remove -yq unattended-upgrades && \
apt-get autoremove -yq

RUN locale-gen en_US.UTF-8
RUN update-locale LANG=en_US.UTF-8

ENV OPT /opt/wtsi-cgp
ENV PATH $OPT/bin:$OPT/biobambam2/bin:$PATH
ENV PERL5LIB $OPT/lib/perl5
ENV LD_LIBRARY_PATH $OPT/lib
ENV LC_ALL en_US.UTF-8
ENV LANG en_US.UTF-8

RUN mkdir -p $OPT
COPY --from=builder $OPT $OPT

## USER CONFIGURATION
RUN adduser --disabled-password --gecos '' ubuntu && chsh -s /bin/bash && mkdir -p /home/ubuntu

USER ubuntu
WORKDIR /home/ubuntu

CMD ["/bin/bash"]
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
The alleleCount package primarily exists to prevent code duplication between some other projects,
specifically AscatNGS and Battenberg.

[![Quay Badge][quay-status]][quay-repo]

| Master | Develop |
| --------------------------------------------- | ----------------------------------------------- |
| [![Master Badge][travis-master]][travis-base] | [![Develop Badge][travis-develop]][travis-base] |
Expand Down Expand Up @@ -160,3 +162,8 @@ identical to a statement that reads ‘Copyright (c) 2005, 2006, 2007, 2008,

<!-- refs -->
[ds-cgpwgs-git]: https://github.com/cancerit/dockstore-cgpwgs

<!-- Quay.io -->
[quay-status]: https://quay.io/repository/wtsicgp/allelecount/status
[quay-repo]: https://quay.io/repository/wtsicgp/allelecount
[quay-builds]: https://quay.io/repository/wtsicgp/allelecount?tab=builds
72 changes: 72 additions & 0 deletions build/opt-build-local.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#! /bin/bash

set -xe

if [[ -z "${TMPDIR}" ]]; then
TMPDIR=/tmp
fi

set -u

if [ "$#" -lt "1" ] ; then
echo "Please provide an installation path such as /opt/ICGC"
exit 1
fi

# get path to this script
SCRIPT_PATH=`dirname $0`;
SCRIPT_PATH=`(cd $SCRIPT_PATH && pwd)`

# get the location to install to
INST_PATH=$1
mkdir -p $1
INST_PATH=`(cd $1 && pwd)`
echo $INST_PATH

# get current directory
INIT_DIR=`pwd`

CPU=`grep -c ^processor /proc/cpuinfo`
if [ $? -eq 0 ]; then
if [ "$CPU" -gt "6" ]; then
CPU=6
fi
else
CPU=1
fi
echo "Max compilation CPUs set to $CPU"

SETUP_DIR=$INIT_DIR/install_tmp
mkdir -p $SETUP_DIR/distro # don't delete the actual distro directory until the very end
mkdir -p $INST_PATH/bin
cd $SETUP_DIR

# make sure tools installed can see the install loc of libraries
set +u
export LD_LIBRARY_PATH=`echo $INST_PATH/lib:$LD_LIBRARY_PATH | perl -pe 's/:\$//;'`
export PATH=`echo $INST_PATH/bin:$PATH | perl -pe 's/:\$//;'`
export MANPATH=`echo $INST_PATH/man:$INST_PATH/share/man:$MANPATH | perl -pe 's/:\$//;'`
export PERL5LIB=`echo $INST_PATH/lib/perl5:$PERL5LIB | perl -pe 's/:\$//;'`
CPANM=`which cpanm`
echo "Installing Perl prerequisites ..."
$CPANM --no-interactive --notest --mirror http://cpan.metacpan.org -l $INST_PATH/ --installdeps $INIT_DIR/perl/. < /dev/null

set -u
### alleleCount
echo "Building alleleCounter ..."
if [ ! -e $SETUP_DIR/alleleCount.success ]; then
#build the C part
cd $INIT_DIR
mkdir -p $INIT_DIR/c/bin
make -C c clean
export prefix=$INST_PATH
make -C c -j$CPU
cp $INIT_DIR/c/bin/alleleCounter $INST_PATH/bin/.
#build the perl part
cd $INIT_DIR/perl
perl Makefile.PL INSTALL_BASE=$INST_PATH
make
make test
make install
touch $SETUP_DIR/alleleCounter.success
fi
86 changes: 86 additions & 0 deletions build/opt-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
#! /bin/bash

set -xe

if [[ -z "${TMPDIR}" ]]; then
TMPDIR=/tmp
fi

set -u

if [ "$#" -lt "1" ] ; then
echo "Please provide an installation path such as /opt/ICGC"
exit 1
fi

# get path to this script
SCRIPT_PATH=`dirname $0`;
SCRIPT_PATH=`(cd $SCRIPT_PATH && pwd)`

# get the location to install to
INST_PATH=$1
mkdir -p $1
INST_PATH=`(cd $1 && pwd)`
echo $INST_PATH

# get current directory
INIT_DIR=`pwd`

CPU=`grep -c ^processor /proc/cpuinfo`
if [ $? -eq 0 ]; then
if [ "$CPU" -gt "6" ]; then
CPU=6
fi
else
CPU=1
fi
echo "Max compilation CPUs set to $CPU"

SETUP_DIR=$INIT_DIR/install_tmp
mkdir -p $SETUP_DIR/distro # don't delete the actual distro directory until the very end
mkdir -p $INST_PATH/bin
cd $SETUP_DIR

# make sure tools installed can see the install loc of libraries
set +u
export LD_LIBRARY_PATH=`echo $INST_PATH/lib:$LD_LIBRARY_PATH | perl -pe 's/:\$//;'`
export PATH=`echo $INST_PATH/bin:$PATH | perl -pe 's/:\$//;'`
export MANPATH=`echo $INST_PATH/man:$INST_PATH/share/man:$MANPATH | perl -pe 's/:\$//;'`
export PERL5LIB=`echo $INST_PATH/lib/perl5:$PERL5LIB | perl -pe 's/:\$//;'`
set -u

## grab cpanm
curl -L http://cpanmin.us | perl - App::cpanminus
CPANM=`which cpanm`

echo "Installing Perl base deps ..."
if [ ! -e $SETUP_DIR/basePerlDeps.success ]; then
perlmods=( "ExtUtils::CBuilder" "Module::Build~0.42" "Const::Fast" "File::Which" "LWP::UserAgent")
for i in "${perlmods[@]}" ; do
$CPANM --no-interactive --notest --mirror http://cpan.metacpan.org -l $INST_PATH $i
done
touch $SETUP_DIR/basePerlDeps.success
fi

SOURCE_HTSLIB="https://github.com/samtools/htslib/releases/download/${VER_HTSLIB}/htslib-${VER_HTSLIB}.tar.bz2"

cd $SETUP_DIR

echo "Downloading htslib ..."
if [ ! -e $SETUP_DIR/htslibGet.success ]; then
cd $SETUP_DIR
wget $SOURCE_HTSLIB
touch $SETUP_DIR/htslibGet.success
fi

echo "Building htslib ..."
if [ ! -e $SETUP_DIR/htslib.success ]; then
mkdir -p htslib
tar --strip-components 1 -C htslib -jxf htslib-${VER_HTSLIB}.tar.bz2
cd htslib
./configure --enable-plugins --enable-libcurl --prefix=$INST_PATH
make -j$CPU
make install
cd $SETUP_DIR
touch $SETUP_DIR/htslib.success
fi
2 changes: 1 addition & 1 deletion c/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ CFLAGS = -g -Wall
HTSLOC?=$(HTSLIB)

HTSTMP?=./htslib_tmp
prefix=?/usr/local/
prefix?=/usr/local/

#Define locations of header files
OPTINC?=-I$(HTSLOC)/
Expand Down
2 changes: 1 addition & 1 deletion perl/lib/Sanger/CGP/AlleleCount.pm
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ package Sanger::CGP::AlleleCount;
use strict;

use base 'Exporter';
our $VERSION = '4.0.2';
our $VERSION = '4.1.0';
our @EXPORT = qw($VERSION);

1;

0 comments on commit a574fed

Please sign in to comment.