-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile.old
99 lines (81 loc) · 3.43 KB
/
Dockerfile.old
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
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 required python libraries
RUN mkdir -p /conf
RUN pip3 install --upgrade pip
COPY requirements.txt /conf/
RUN env-build-tool new /conf/requirements.txt ${py_env_path} /wheels
# install ODC
FROM opendatacube/geobase:runner-3.0.4
ARG py_env_path=/env
COPY --chown=1000:100 --from=env_builder $py_env_path $py_env_path
COPY --from=env_builder /bin/tini /bin/tini
RUN export GDAL_DATA=$(gdal-config --datadir)
ENV LC_ALL=C.UTF-8 \
PATH="/env/bin:$PATH"
RUN useradd -m -s /bin/bash -N jovyan -g 100 -u 1000 \
&& chown jovyan /home/jovyan \
&& addgroup jovyan staff
# install R dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
software-properties-common \
dirmngr \
ed \
less \
locales \
vim-tiny \
wget \
ca-certificates \
&& 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
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
ENV TZ UTC
# 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 \
r-base \
r-base-dev \
r-recommended \
&& ln -s /usr/lib/R/site-library/littler/examples/install.r /usr/local/bin/install.r \
&& ln -s /usr/lib/R/site-library/littler/examples/install2.r /usr/local/bin/install2.r \
&& ln -s /usr/lib/R/site-library/littler/examples/installGithub.r /usr/local/bin/installGithub.r \
&& ln -s /usr/lib/R/site-library/littler/examples/testInstalled.r /usr/local/bin/testInstalled.r \
&& install.r docopt \
&& rm -rf /tmp/downloaded_packages/ /tmp/*.rds \
&& rm -rf /var/lib/apt/lists/*
# 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 \
libprotobuf-dev protobuf-compiler libv8-dev libjq-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", "geojsonio", "gdalUtils"))'
RUN R -e 'devtools::install_github("eo2cube/odcr")'
RUN R -e 'install.packages(c("IRkernel"))'
# initiliaze R kernel for Jupyter
RUN R -e "IRkernel::installspec(user = FALSE)"
## automatically link a shared volume for kitematic users
#VOLUME /home/rstudio/kitematic
# set user and working dir
USER jovyan
WORKDIR /notebooks
#CMD bash -c " && rstudio-server start"
#RUN "/init"
ENTRYPOINT ["/bin/tini", "--"] # "entrypoint.sh"
CMD ["jupyter", "notebook", "--allow-root", "--ip='0.0.0.0'" "--NotebookApp.token='secretpassword'"]
#CMD ["rstudio-server start"]