bootstrap: docker
From: continuumio/miniconda3:4.5.11

# TODO - support also GPU environmnets

%help
    This container provides portable & reproducible environment for running
    Kipoi moddels.

    Please see https://github.com/kipoi/kipoi for complete documentation.

%post
    # install sys-dependencies
    apt-get update
    apt-get install -y build-essential libz-dev libcurl3-dev

    # Configure Kipoi
    export PATH=$PATH:/opt/conda/bin
    export LC_ALL=C

    # Place to store kipoi environment database
    mkdir -p /kipoi
    export KIPOI_ENV_DB_PATH=/kipoi/envs.json

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

    # install kipoi from the master branch for now
    # TODO - use a specific tag for the build
    pip install git+https://github.com/kipoi/kipoi

    # Create all the environments
    kipoi ls # list all environments to load the remote repo
    kipoi env create all --vep

    # add write-permission to anyone
    chmod go+r /kipoi/envs.json

    # clean packages
    conda clean --index-cache --tarballs --packages --yes

%environment
    export LC_ALL=C
    export PATH=$PATH:/opt/conda/bin

    # Move the json database to tempdir
    random_string=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 13 ; echo '')
    tmpdir=/tmp/kipoi/$random_string
    mkdir -p $tmpdir
    cp /kipoi/envs.json $tmpdir/envs.json
    export KIPOI_ENV_DB_PATH=$tmpdir/envs.json
    
%labels
    Maintainer avsecz
    Version v0.1
