Skip to content

Instantly share code, notes, and snippets.

@paleolimbot
Created August 12, 2020 23:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paleolimbot/91e7ab2cc308e1b69077962fc7b04406 to your computer and use it in GitHub Desktop.
Save paleolimbot/91e7ab2cc308e1b69077962fc7b04406 to your computer and use it in GitHub Desktop.
FROM rocker/r-ubuntu:18.04
# RStudio Package Manager cache of June 3, 2020
ENV RSPM https://packagemanager.rstudio.com/all/__linux__/bionic/290
# system dependencies for R packages
RUN apt-get update && apt-get install -y libcurl4-openssl-dev libxml2-dev libssl-dev
# install R package dependencies
RUN Rscript -e "install.packages('remotes')"
RUN Rscript -e "options(repos = c(REPO_NAME = Sys.getenv('RSPM'))); remotes::install_cran(c('assertr', 'bookdown', 'broom', 'compositions', 'dplyr', 'forcats', 'ggdendro', 'ggplot2', 'ggrepel', 'glue', 'gridExtra', 'kableExtra', 'knitr', 'lubridate', 'memoise', 'mgcv', 'mudata2', 'patchwork', 'PeriodicTable', 'purrr', 'readr', 'rioja', 'rlang', 'scales', 'segmented', 'stringr', 'testthat', 'tibble', 'tidyr', 'tidyverse', 'withr', 'yaml'))"
RUN Rscript -e "options(repos = c(REPO_NAME = Sys.getenv('RSPM'))); remotes::install_github(c('paleolimbot/tidypaleo@32525aa', 'paleolimbot/pb210@ebd0920'))"
# install xelatex + packages needed
RUN apt-get install -y pandoc
RUN echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections && apt-get install -y ttf-mscorefonts-installer
RUN Rscript -e "options(repos = c(REPO_NAME = Sys.getenv('RSPM'))); remotes::install_cran('tinytex'); tinytex::install_tinytex(); tinytex::tlmgr_install(c('caption', 'pdflscape', 'logreq', 'biblatex', 'mathspec', 'multirow', 'tabu', 'colortbl', 'varwidth', 'threeparttable', 'wrapfig', 'threeparttable', 'threeparttablex', 'environ', 'trimspaces', 'ulem', 'makecell', 'biber'))"
RUN Rscript -e "options(repos = c(REPO_NAME = Sys.getenv('RSPM'))); remotes::install_cran('analogue')"
@paleolimbot
Copy link
Author

Render using current R env:

# do this once (installs packages required for thesis):
# source('INSTALL.R')
bookdown::render_book('index.Rmd', 'bookdown::pdf_book')

Or use the docker image to render:

# do this once:
# docker build . --tag dd-thesis
docker run -v $(pwd):/thesis -w /thesis dd-thesis Rscript -e "bookdown::render_book('index.Rmd', 'bookdown::pdf_book')"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment