BootStrap: docker
From: centos:8

%help
This is a singularity container packing picard tools v3.0.0 and java 17. An R installation (4.3.3) is also provided as it is required by some picard tools. 
Author : yannis.duffourd@u-bourgogne.fr, valentin.vautrot@u-bourgogne.fr

This singularity recipe is open source and free. Please redistribute it as well.
No warranty is provided.

%post
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*

dnf update -y --exclude=filesystem
dnf install -y epel-release wget
dnf --enablerepo=powertools install -y openblas-devel

# # install R with (old) java included
# dnf install -y R-4.3.3-1.el8.x86_64
# dnf remove -y java-1.8.0-openjdk java-1.8.0-openjdk-devel java-1.8.0-openjdk-headless

# # install R
dnf install -y R-core-4.3.3-1.el8.x86_64

# # install java
dnf install -y java-17-openjdk java-17-openjdk-devel

# # install picard
mkdir /opt/picard_3.0.0
wget -O /opt/picard_3.0.0/picard.jar https://github.com/broadinstitute/picard/releases/download/3.0.0/picard.jar 

# cleanup       

%labels
Maintainer Yannis Duffourd
Updater Yannis Duffourd <yannis.duffourd@u-bourgogne.fr>
ContainerVersion v1.1
PicardTools 3.0.0 (Broad institute)
R version 4.3.3
Java version 17.0.1

%environment
    export JAVA_HOME=$(dirname $(dirname $(readlink $(readlink $(which java)))))
    export PATH=$PATH:$JAVA_HOME/bin

%runscript
echo "java version : "
java -version
echo "R version : "
R --version