From 69f8eb14fd8c923a834bc0e1786850680f4e10fc Mon Sep 17 00:00:00 2001 From: 16EAGLE Date: Fri, 11 Jun 2021 14:41:04 +0200 Subject: [PATCH] updated Dockerfile to install spatial packages --- Dockerfile | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index 874a684..95df68d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,11 @@ FROM ubuntu:focal FROM opendatacube/geobase:wheels-3.0.4 as env_builder - ARG py_env_path=/env +# set rpy2 to ABI mode, since R is installed after rpy2 ENV RPY2_CFFI_MODE=ABI +# install python dependencies RUN mkdir -p /conf COPY requirements.txt /conf/ RUN env-build-tool new /conf/requirements.txt ${py_env_path} /wheels @@ -23,8 +24,7 @@ RUN useradd -m -s /bin/bash -N jovyan -g 100 -u 1000 \ && chown jovyan /home/jovyan \ && addgroup jovyan staff -# R kernel install - +# install R dependencies RUN apt-get update \ && apt-get install -y --no-install-recommends \ software-properties-common \ @@ -38,23 +38,20 @@ RUN apt-get update \ && add-apt-repository --enable-source --yes "ppa:marutter/rrutter4.0" \ && add-apt-repository --enable-source --yes "ppa:c2d4u.team/c2d4u4.0+" -## Configure default locale, see https://github.com/rocker-org/rocker/issues/19 +# configure default locale, see https://github.com/rocker-org/rocker/issues/19 RUN echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen \ && locale-gen en_US.utf8 \ && /usr/sbin/update-locale LANG=en_US.UTF-8 +# set env variables for noninteractive ENV LC_ALL en_US.UTF-8 ENV LANG en_US.UTF-8 - -## This was not needed before but we need it now -ENV DEBIAN_FRONTEND noninteractive - -## Otherwise timedatectl will get called which leads to 'no systemd' inside Docker ENV TZ UTC -# Now install R and littler, and create a link for littler in /usr/local/bin +# install R and littler, and create a link for littler in /usr/local/bin # Default CRAN repo is now set by R itself, and littler knows about it too # r-cran-docopt is not currently in c2d4u so we install from source +ARG DEBIAN_FRONTEND=noninteractive RUN apt-get update \ && apt-get install -y --no-install-recommends \ littler \ @@ -69,11 +66,19 @@ RUN apt-get update \ && rm -rf /tmp/downloaded_packages/ /tmp/*.rds \ && rm -rf /var/lib/apt/lists/* -RUN apt-get update&&apt-get install -y --no-install-recommends r-cran-reticulate libudunits2-dev sqlite3 -RUN R -e 'install.packages(c("IRkernel", "rgdal", "sf", "stars", "raster", "basemaps"))' -#, "raster", "sp", "sf", "stars", "basemaps", "mapview", "mapedit", "devtools", "usethis", "testthat", "roxygen2", "ggplot2"))' +# install system dependencies for suite of spatial R packages +ARG DEBIAN_FRONTEND=noninteractive +RUN apt-get update&&apt-get install -y apt-utils pkg-config +RUN apt-get install -y libsqlite3-dev libudunits2-dev libssl-dev libmagick++-dev libcurl4-openssl-dev +RUN apt-get update&&apt-get install -y --no-install-recommends r-cran-reticulate + +# install R packages +RUN R -e 'install.packages(c("IRkernel", "rgdal", "sp", "raster", "sf", "basemaps", "ggplot2", "mapview", "mapedit", "devtools", "usethis", "testthat", "roxygen2"))' + +# initiliaze R kernel for Jupyter RUN R -e "IRkernel::installspec(user = FALSE)" +# set user and working dir USER jovyan WORKDIR /notebooks