R-Docker-Starting-point/Dockerfile.Full
2026-01-12 12:23:08 -07:00

34 lines
2.3 KiB
Docker

#Date Created: Jan 8, 2026
#Author Alex Gebben <agebben@mines.edu,agebben@uwyo.edu>
FROM rocker/r-ver:4.5.2
LABEL org.opencontainers.image.authors=agebben@uwyo.edu
RUN apt-get update \
&& apt-get install -y sudo
#Create a sudo user not called root. This avoids permision issues when working with the files created in the docker and saved on a local unix system
#RUN useradd -m -s /bin/bash rdocker
RUN adduser --disabled-password --gecos '' rdocker \
&& adduser rdocker sudo \
&& echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers \
&& chmod 777 /usr/local/lib/R/site-library
USER rdocker
#Install all necessary packages for anaylysis, file manipulation, or for the required R packages to function.
RUN sudo apt-get install -y libmariadb-dev imagemagick ghostscript libpoppler-cpp-dev vim wget curl git libcurl4-openssl-dev build-essential texlive-full chromium-browser firefox default-jdk # chromium-browser, firefox, and default-jdk used for web scraping with the R-package selenider.
#Install the R packages used in the R data creation scripts run on on the docker container.
RUN install2.r tidyverse fixest twang pdftools gt scales vars curl forecast uuid corrplot foreach cluster factoextra xtable Formula miscTools MASS kableExtra clisymbols fredr readxl lubridate tidycensus zipcodeR stargazer sandwich lmtest ggnewscale viridis ggthemes MatchIt optmatch aTSA tsDyn bruceR svars tidyquant zoo eia renv BiocManager miscTools logr selenium selenider && rm -rf /tmp/downloaded_packages
#Packages used in DCchoice nuclear contigent valuation paper which require a special install method
#Icens is required to be installed using BiocManager for DCchoice to be installed.
#"interval" required Icens to be installed
#BiocManager Version will need to be updated periodically.
RUN R -e 'BiocManager::install(version = "3.22")'\
&& R -e 'BiocManager::install("Icens")' \
&& R -e "install.packages('DCchoice',dependencies=TRUE)" \
&& install2.r interval \
&& rm -rf /tmp/downloaded_packages
WORKDIR /R-Code
RUN sudo chmod -R 777 /R-Code
#Add VIM R IDE to work in the Container, not required.
#Packages used for a vim-R IDE. Can be removed if not used
#Add vimrc which can be used with vimplug to run an R ide to perform R edits in the terminal.
ADD VIM_R_IDE/.vimrc /home/rdocker/.vimrc