-
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: data processing extract base image docker file R packages
- Loading branch information
1 parent
779cd84
commit ac50b01
Showing
4 changed files
with
141 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
# Dockerfile.r | ||
FROM ubuntu:18.04 | ||
|
||
LABEL maintainer="Chris Kittel <christopher.kittel@openknowledgemaps.org>" | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
ARG R_VERSION | ||
ARG BUILD_DATE | ||
ARG CRAN | ||
ENV R_VERSION=${R_VERSION:-3.6.3} \ | ||
CRAN=${CRAN:-https://cran.rstudio.com} | ||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
bash-completion \ | ||
ca-certificates \ | ||
file \ | ||
fonts-texgyre \ | ||
g++ \ | ||
gfortran \ | ||
gsfonts \ | ||
libblas-dev \ | ||
libbz2-1.0 \ | ||
libcurl4 \ | ||
libjpeg-turbo8-dev \ | ||
libopenblas-dev \ | ||
libpangocairo-1.0-0 \ | ||
libpcre3 \ | ||
libpng16-16 \ | ||
libreadline7 \ | ||
libtiff5 \ | ||
liblzma5 \ | ||
locales \ | ||
make \ | ||
unzip \ | ||
zip \ | ||
zlib1g \ | ||
&& echo "en_US.UTF-8" >> /etc/locale.gen \ | ||
&& locale-gen en_US.UTF-8 \ | ||
&& /usr/sbin/update-locale LANG=en_US.UTF-8 | ||
|
||
ENV BUILDDEPS="curl \ | ||
default-jdk \ | ||
libbz2-dev \ | ||
libcairo2-dev \ | ||
libcurl4-openssl-dev \ | ||
libpango1.0-dev \ | ||
libjpeg-dev \ | ||
libpcre3-dev \ | ||
libpng-dev \ | ||
libreadline-dev \ | ||
libtiff5-dev \ | ||
liblzma-dev \ | ||
libx11-dev \ | ||
libxt-dev \ | ||
perl \ | ||
tcl8.6-dev \ | ||
tk8.6-dev \ | ||
x11proto-core-dev \ | ||
xauth \ | ||
xfonts-base \ | ||
xvfb \ | ||
zlib1g-dev" | ||
|
||
RUN apt-get install -y --no-install-recommends $BUILDDEPS | ||
|
||
RUN mkdir -p /tmp/build && cd /tmp/build \ | ||
&& curl -O https://cran.r-project.org/src/base/R-3/R-${R_VERSION}.tar.gz \ | ||
&& tar -xf R-${R_VERSION}.tar.gz \ | ||
&& cd R-${R_VERSION} \ | ||
&& R_PAPERSIZE=letter \ | ||
R_BATCHSAVE="--no-save --no-restore" \ | ||
R_BROWSER=xdg-open \ | ||
PAGER=/usr/bin/pager \ | ||
PERL=/usr/bin/perl \ | ||
R_UNZIPCMD=/usr/bin/unzip \ | ||
R_ZIPCMD=/usr/bin/zip \ | ||
R_PRINTCMD=/usr/bin/lpr \ | ||
LIBnn=lib \ | ||
AWK=/usr/bin/awk \ | ||
CFLAGS="-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g" \ | ||
CXXFLAGS="-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g" \ | ||
./configure --enable-R-shlib \ | ||
--enable-memory-profiling \ | ||
--with-readline \ | ||
--with-blas \ | ||
--with-tcltk \ | ||
--disable-nls \ | ||
--with-recommended-packages \ | ||
&& make \ | ||
&& make install | ||
|
||
RUN mkdir -p /usr/local/lib/R/site-library \ | ||
&& chown root:staff /usr/local/lib/R/site-library \ | ||
&& chmod g+ws /usr/local/lib/R/site-library \ | ||
&& sed -i '/^R_LIBS_USER=.*$/d' /usr/local/lib/R/etc/Renviron \ | ||
&& echo "R_LIBS_USER=\${R_LIBS_USER-'/usr/local/lib/R/site-library'}" >> /usr/local/lib/R/etc/Renviron \ | ||
&& echo "R_LIBS=\${R_LIBS-'/usr/local/lib/R/site-library:/usr/local/lib/R/library:/usr/lib/R/library'}" >> /usr/local/lib/R/etc/Renviron \ | ||
&& if [ -z "$BUILD_DATE" ]; then MRAN=$CRAN; else MRAN=https://mran.microsoft.com/snapshot/${BUILD_DATE}; fi \ | ||
&& echo MRAN=$MRAN >> /etc/environment \ | ||
&& echo "options(repos = c(CRAN='$MRAN'), download.file.method = 'libcurl')" >> /usr/local/lib/R/etc/Rprofile.site | ||
|
||
RUN Rscript -e "install.packages(c('littler', 'docopt'), repo = '$CRAN')" \ | ||
&& ln -s /usr/local/lib/R/site-library/littler/examples/install2.r /usr/local/bin/install2.r \ | ||
&& ln -s /usr/local/lib/R/site-library/littler/examples/installGithub.r /usr/local/bin/installGithub.r \ | ||
&& ln -s /usr/local/lib/R/site-library/littler/bin/r /usr/local/bin/r | ||
|
||
RUN cd / && rm -rf /tmp/build \ | ||
&& apt-get remove --purge -y $BUILDDEPS \ | ||
&& apt-get autoremove -y \ | ||
&& apt-get autoclean -y \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
RUN locale-gen en_US.UTF-8 && \ | ||
update-locale LANG=en_US.UTF-8 && \ | ||
update-locale LC_ALL=en_US.UTF-8 && \ | ||
dpkg-reconfigure locales | ||
|
||
CMD ["R", "--version"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
# Build the R base image from Dockerfile.r (context set to ../..) | ||
docker build -t r-base:latest -f Dockerfile.r ../.. | ||
|
||
# Build the main dataprocessing image using the prebuilt R base image | ||
docker build -t headstart-dataprocessing:latest -f Dockerfile ../.. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters