#INFORMATION
#MAINTAINER Sebastien RAVEL
#version="1.0"

FROM ubuntu:focal
USER root

# ENVIRONMENT

# INSTALL, Global

RUN DEBIAN_FRONTEND=noninteractive
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
RUN apt-get update && apt-get upgrade -y
RUN ln -fs /usr/share/zoneinfo/Europe/Paris /etc/localtime
RUN apt-get install -y apt-utils dialog
RUN apt-get install -y tzdata
RUN dpkg-reconfigure --frontend noninteractive tzdata
RUN apt-get -y install keyboard-configuration git vim curl wget less locate graphviz python3-pip
RUN apt-get -y install python3.8 python3.8-dev python3.8-venv
RUN apt-get -y install python3.9 python3.9-dev python3.9-venv
RUN apt-get install --fix-missing
# Install for Python
RUN echo 'export LC_ALL=C.UTF-8' >> /environment
RUN echo 'export LANG=C.UTF-8' >> /environment
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8
RUN python3.8 -m pip install tox
RUN python3.9 -m pip install tox

# installing Singularity
RUN wget https://go.dev/dl/go1.18.3.linux-amd64.tar.gz
RUN tar -C /usr/local -xzvf go1.18.3.linux-amd64.tar.gz
RUN rm go1.18.3.linux-amd64.tar.gz
ENV PATH=/usr/local/go/bin:$PATH

## Install Singularity itself
RUN apt-get -y install libseccomp2 libseccomp-dev libglib2.0-dev
RUN wget https://github.com/sylabs/singularity/releases/download/v3.10.0/singularity-ce-3.10.0.tar.gz
RUN tar -xzf singularity-ce-3.10.0.tar.gz
ENV PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig/
RUN cd /singularity-ce-3.10.0 && ./mconfig -p /usr/local && make -C builddir && make -C builddir install
RUN cd .. && rm singularity-ce-3.10.0.tar.gz
# Download build singularity
RUN mkdir -p /usr/local/rattleSNP/Containers && cd /usr/local/rattleSNP/Containers && wget --no-check-certificate -rm -nH --cut-dirs=2 --reject="index.html*" --no-parent http://nas-bgpi.myds.me/DOC/rattleSNP/Singularity.rattleSNP_tools.sif
RUN mkdir -p /usr/local/rattleSNP/Containers && cd /usr/local/rattleSNP/Containers && wget --no-check-certificate -rm -nH --cut-dirs=2 --reject="index.html*" --no-parent http://nas-bgpi.myds.me/DOC/rattleSNP/Singularity.report.sif
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get -y install r-base-core --fix-missing
RUN apt-get clean