BootStrap: docker
From: ubuntu:latest

###############################################
# do not change. This is a tagged version 0.4.3
###############################################

%labels
  maintainer Bertrand Neron <bneron@pasteur.fr>
  package.name bioconvert
  package.version 0.4.3
  package.homepage https://pypi.python.org/pypi/bioconvert/0.4.3
  package.source.url https://github.com/bioconvert/bioconvert
  package.license GPLv3

%post
  ######### install system #########
  export BIOCONVERT_VERSION="0.4.3"


  apt-get update -y
  apt-get install -y wget bzip2 build-essential
  apt-get install -y libgl1-mesa-glx
  apt-get install -y build-essential

  # install anaconda
  if [ ! -d /usr/local/anaconda ]; then
      # wget https://repo.continuum.io/miniconda/Miniconda3-4.3.14-Linux-x86_64.sh\
      # for now, we use 4.2.12 to have python3.5 by default so no need to
      # create a new env saving space in the process. The reason for using 3.5
      # is inherent to the packages used at the moment.
      wget https://repo.continuum.io/miniconda/Miniconda3-4.2.12-Linux-x86_64.sh\
           -O anaconda.sh && \
      bash anaconda.sh -b -p /usr/local/anaconda && \
      rm anaconda.sh
  fi

  # set anaconda path
  export PATH=${PATH}:/usr/local/anaconda/bin
  conda update conda

  conda config --add channels r
  conda config --add channels defaults
  conda config --add channels conda-forge
  conda config --add channels bioconda

  # The main packages for sequana:
  conda install --file https://raw.githubusercontent.com/biokit/bioconvert/master/requirements.txt
  conda install --file https://raw.githubusercontent.com/biokit/bioconvert/master/requirements_tools.txt
  # linux only:
  conda install mosdepth --yes


  #conda install -y graphviz==2.38 pygraphviz

  ######### install bioconvert #########
  pip install biocode
  pip install bioconvert==${BIOCONVERT_VERSION}

  if [ ! -d /etc/localtime ]; then
    mkdir /etc/localtime
  fi

  # Uses agg as backend instead of qt (less dependencies)
  echo "backend:tkagg" > matplotlibrc

  ######## clean image ########
  apt-get autoremove -y
  apt-get clean -y
  conda clean -y --all

%environment
  export PATH=${PATH}:/usr/local/anaconda/bin


%runscript
  exec /usr/local/anaconda/bin/bioconvert "$@"


