-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDockerfile
118 lines (109 loc) · 3.24 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#source: https://lalejini.com/2021/01/09/bookdown-autodeploy.html (with several modifications)
# Pull a base image
FROM ubuntu:latest
# Copy everything (minus anything specified in .dockerignore) into the image
COPY . /opt/easypeasyespanol.github.io
# To make installs not ask questions about timezones
ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=America/New_York
##############################
# install base dependencies
# - for R repository
# - dirmngr
# - gpg-agent
# - for bookdown compilation
# - pandoc, pandoc-citeproc, texlive-base, texlive-latex-extra
##############################
RUN apt-get update && apt-get install -y --no-install-recommends apt-utils \
&& \
apt-get update \
&& \
apt-get install -y -qq --no-install-recommends \
software-properties-common \
curl \
g++-10 \
make\
cmake \
python3 \
python3-pip \
python3-virtualenv \
git \
dirmngr \
gpg-agent \
pandoc \
pandoc-citeproc \
texlive-base \
texlive-latex-extra \
texlive-xetex \
lmodern \
ttf-mscorefonts-installer \
fontconfig \
cabextract \
&& \
echo "installed base dependencies" \
&& \
########################################################
# setup fonts
# - need the Arial font
########################################################
wget https://www.freedesktop.org/software/fontconfig/webfonts/webfonts.tar.gz \
&& \
tar -xzf webfonts.tar.gz \
&& \
cd msfonts/ \
&& \
cabextract *.exe \
&& \
fc-cache -fv \
&& \
cp *.ttf *.TTF /usr/local/share/fonts/ \
&& \
fc-cache -fv \
&& \
echo "installed fonts" \
&& \
fc-list \
&& \
########################################################
# install r with whatever r packages we need/want
# - source: https://rtask.thinkr.fr/installation-of-r-4-0-on-ubuntu-20-04-lts-and-tips-for-spatial-packages/
########################################################
apt-get install -y -q --no-install-recommends \
r-base \
r-base-dev \
libssl-dev \
libcurl4-openssl-dev \
libfreetype6-dev \
libmagick++-dev \
libxml2-dev \
libfontconfig1-dev \
cargo \
&& \
R -e "install.packages('rmarkdown', dependencies=NA, repos='http://cran.rstudio.com/')" \
&& \
R -e "install.packages('knitr', dependencies=NA, repos='http://cran.rstudio.com/')" \
&& \
R -e "install.packages('bookdown', dependencies=NA, repos='http://cran.rstudio.com/')" \
&& \
R -e "install.packages('tidyverse',dependencies=NA, repos='http://cran.rstudio.com/')" \
&& \
R -e "install.packages('cowplot',dependencies=NA, repos='http://cran.rstudio.com/')" \
&& \
echo "installed r and configured r environment" \
&& \
########################################################
# build book
########################################################
cd /opt/easypeasyespanol.github.io \
&& \
Rscript -e "install.packages('tinytex')" \
&& \
Rscript -e "tinytex::install_tinytex(force = TRUE)" \
&& \
Rscript -e "bookdown::render_book('index.Rmd', 'bookdown::gitbook')" \
&& \
Rscript -e "bookdown::render_book('index.Rmd', 'bookdown::pdf_book')" \
&& \
Rscript -e "bookdown::render_book('index.Rmd', 'bookdown::epub_book')" \
&& \
echo "compiled bookdown ebook"