# R container
FROM rocker/verse:4.1.0

ENV TZ=Europe
ENV DEBIAN_FRONTEND noninteractive

# Essential tools
WORKDIR /tmp
COPY /scripts/apt_get_essential.sh .
RUN chmod +x apt_get_essential.sh
RUN bash apt_get_essential.sh

RUN apt-get update -y && apt-get install -y libperl-dev

# R packages
RUN R -e 'install.packages("tidyverse")'
RUN R -e 'install.packages("patchwork")'
RUN R -e 'install.packages("cowplot")'
RUN R -e 'install.packages("foreign")'
RUN R -e 'install.packages("mvtnorm")'

RUN R -e 'setRepositories(ind=1:8); install.packages("devtools")'
RUN R -e 'install.packages("remotes")'

RUN R -e 'remotes::install_github("zhanxw/seqminer")'
RUN R -e 'remotes::install_github("dajiangliu/rareGWAMA")'
RUN R -e 'remotes::install_github("GenomicSEM/GenomicSEM")'
RUN R -e 'remotes::install_github("norment/normentR")'

RUN R -e 'remotes::install_github("MRCIEU/TwoSampleMR")'

RUN R -e 'install.packages("survey")'
RUN R -e 'install.packages("http://cnsgenomics.com/software/gsmr/static/gsmr_1.0.9.tar.gz", repos = NULL, type = "source")'

# gcta (good to have this in R container because gsmr package uses gcta)
WORKDIR /tools/gcta
COPY /scripts/install_gcta.sh /tmp
RUN chmod +x /tmp/install_gcta.sh
RUN bash /tmp/install_gcta.sh

WORKDIR /tools
