BootStrap: debootstrap
OSVersion: focal
MirrorURL: http://us.archive.ubuntu.com/ubuntu/

%files
    Contams_companion.py /opt/
    contam-labels.idl /opt/
    chimeric_companion.py /opt/
    kraken-parser.pl /opt/
    create-labeler.pl /opt/

%environment
    export PATH=/opt/usr/local/bin:$PATH
    export PATH=/opt/miniconda/bin:$PATH
    export PATH=/opt/diamond:$PATH
    export PATH=/opt/Prodigal:$PATH

%post
    # Ubuntu

    ## permissions
    chmod -R 777 /opt           # chmod775 can be enough
    chmod -R 777 /root          # chmod775 can be enough

    ## update repository for apt
    apt install -y software-properties-common
    apt-add-repository universe
    apt update

    ## UFT8
    apt install -y locales
    localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8

    #basic
    apt install git -y
    apt install python3.8 -y
    apt-get install python3-pip -y
    apt-get install wget -y
    apt-get install unzip -y
    apt-get install rsync -y
    apt install cpanminus -y
    apt-get install libssl-dev -y

    #instal conda
    cd /opt/
    wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
    bash Miniconda3-latest-Linux-x86_64.sh -b -p /opt/miniconda
    export PATH=/opt/miniconda/bin:$PATH
    conda install -c bioconda python=3.7 -y

    #Prodigal
    cd /opt
    git clone https://github.com/hyattpd/Prodigal
    cd Prodigal/
    make install
    export PATH=/opt/Prodigal:$PATH

    #Diamond
    cd /opt/
    mkdir diamond
    cd diamond/
    wget http://github.com/bbuchfink/diamond/releases/download/v2.0.4/diamond-linux64.tar.gz
    tar xzf diamond-linux64.tar.gz
    export PATH=/opt/diamond:$PATH

    #Checkm2
    pip3 install scikit-learn
    pip3 install h5py
    pip3 install numpy
    pip3 install tensorflow
    pip3 install lightgbm
    pip3 install pandas
    pip3 install scipy
    pip3 install setuptools
    pip3 install requests
    pip3 install packaging
    pip3 install tqdm
    cd /opt/
    python setup.py install
    

%runscript
    echo "This container contains : "
    CheckM2

%help
    This is a container for contamination detection
 
%labels
    Author Luc Cornet
    Version v0.0.1
