FROM rocker/r-ver:4.2.2

RUN mkdir /home/analysis
RUN mkdir /home/analysis/data

RUN apt-get update && apt-get install -y
RUN apt-get install libmpfr-dev -y
RUN apt-get install libgmp3-dev -y
RUN apt-get install tk -y

RUN R -e "install.packages(c('remotes', 'microbenchmark'));"

RUN R -e "require(remotes); \
  install_version('rugarch', version = '1.4-9')"

RUN R -e "require(remotes); \
  install_version('rmgarch', version = '1.3-9')"


COPY replication_script.R /home/analysis/replication_script.R
COPY dow29.csv /home/analysis/data/dow29.csv

CMD cd /home/analysis && R -e "source('replication_script.R')"
