Skip to content

Instantly share code, notes, and snippets.

@mokztk
Created July 20, 2020 16:23
Show Gist options
  • Save mokztk/595ade9c33836099300b65c1a320541b to your computer and use it in GitHub Desktop.
Save mokztk/595ade9c33836099300b65c1a320541b to your computer and use it in GitHub Desktop.
rocker/tidyvrese:4.0.1 をベースにradianと日本語フォント、頻用パッケージを追加する
## CRAN repository fixed to June 25, 2020 via RStudio Package Manager
## Ref: https://github.com/rocker-org/rocker-versioned2/blob/master/dockerfiles/Dockerfile_r-ver_4.0.1
# ENV CRAN=https://packagemanager.rstudio.com/all/__linux__/focal/296
FROM rocker/tidyverse:4.0.1
# Change environment to Japanese (Character, DateTime, and Fonts)
ENV DEBCONF_NOWARNINGS=yes \
LANG=ja_JP.UTF-8 \
LC_ALL=ja_JP.UTF-8
RUN set -x \
# install Japanese lung pack (and locales)
&& apt-get update \
&& apt-get install -y language-pack-ja-base language-pack-ja \
# locale settings
&& sed -i '$d' /etc/locale.gen \
&& echo "ja_JP.UTF-8 UTF-8" >> /etc/locale.gen \
&& locale-gen ja_JP.UTF-8 \
&& /usr/sbin/update-locale LANG=ja_JP.UTF-8 LANGUAGE="ja_JP:ja" \
&& /bin/bash -c "source /etc/default/locale" \
&& ln -sf /usr/share/zoneinfo/Asia/Tokyo /etc/localtime \
# install CJK font
&& apt-get install -y --no-install-recommends fonts-noto-cjk \
# cleaning
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install ssh client, pip3 and required libraries
RUN set -x \
&& apt-get update -qq \
&& apt-get install -y --no-install-recommends \
ssh \
python3-pip \
graphviz \
libgraphviz-dev \
imagemagick \
libmagick++-dev \
libgl1-mesa-dev \
libglu1-mesa-dev \
librsvg2-dev \
libxft-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install R packages
RUN set -x \
&& Rscript -e "BiocManager::install(c('graph', 'Rgraphviz'))" \
&& install2.r --error --deps TRUE --ncpus -1 --skipinstalled \
pacman \
tidylog \
furrr \
glmnetUtils \
pROC \
cmprsk \
psych \
clinfun \
car \
ggfortify \
ggsci \
tableone \
# since package "export" was removed from CRAN on 2020-02-21,
# install dev version from GitHub repo (commit d29650b / 2020-06-22)
officer \
rvg \
openxlsx \
flextable \
xtable \
rgl \
stargazer \
tikzDevice \
&& installGithub.r tomwenseleers/export@d29650b
# Install radian: A 21 century R console
RUN set -x \
&& pip3 install -U radian \
# Radian settings
&& echo 'options(radian.color_scheme = "monokai")' > /home/rstudio/.radian_profile \
&& echo 'options(radian.auto_match = TRUE)' >> /home/rstudio/.radian_profile \
&& echo 'options(radian.prompt = "\033[0;32mr$>\033[0m ")' >> /home/rstudio/.radian_profile \
&& echo 'options(radian.escape_key_map = list(list(key = "m", value = " %>% ")))' >> /home/rstudio/.radian_profile \
&& chown rstudio:rstudio /home/rstudio/.radian_profile
# start RStudio Server
CMD ["/init"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment