Skip to content

Commit 4211d4f

Browse files
committed
Updated to include upstream changes as of commit opendatacube/cube-in-a-box@a34c50e
1 parent 7cd1c99 commit 4211d4f

6 files changed

+185
-50
lines changed

Dockerfile

+45-42
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,31 @@
1-
FROM ubuntu:focal
2-
3-
FROM opendatacube/geobase:wheels-3.0.4 as env_builder
4-
ARG py_env_path=/env
5-
1+
FROM osgeo/gdal:ubuntu-small-3.3.1
2+
3+
ENV DEBIAN_FRONTEND=noninteractive \
4+
LC_ALL=C.UTF-8 \
5+
LANG=C.UTF-8 \
6+
TINI_VERSION=v0.19.0 \
7+
TZ=UTC \
8+
RPY2_CFFI_MODE=ABI
69
# set rpy2 to ABI mode, since R is installed after rpy2
7-
ENV RPY2_CFFI_MODE=ABI
8-
9-
# install required python libraries
10-
RUN mkdir -p /conf
11-
RUN pip3 install --upgrade pip
12-
COPY requirements.txt /conf/
13-
RUN env-build-tool new /conf/requirements.txt ${py_env_path} /wheels
1410

15-
# install ODC
16-
FROM opendatacube/geobase:runner-3.0.4
17-
ARG py_env_path=/env
11+
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
12+
RUN chmod +x /tini
13+
14+
RUN apt-get update && \
15+
apt-get install -y \
16+
build-essential \
17+
git \
18+
# For Psycopg2
19+
libpq-dev python3-dev \
20+
python3-pip \
21+
wget \
22+
&& apt-get autoclean \
23+
&& apt-get autoremove \
24+
&& rm -rf /var/lib/{apt,dpkg,cache,log}
1825

19-
COPY --chown=1000:100 --from=env_builder $py_env_path $py_env_path
20-
COPY --from=env_builder /bin/tini /bin/tini
21-
22-
RUN export GDAL_DATA=$(gdal-config --datadir)
23-
ENV LC_ALL=C.UTF-8 \
24-
PATH="/env/bin:$PATH"
26+
COPY requirements.txt /conf/
27+
#COPY products.csv /conf/
28+
RUN pip3 install --no-cache-dir --requirement /conf/requirements.txt
2529

2630
RUN useradd -m -s /bin/bash -N jovyan -g 100 -u 1000 \
2731
&& chown jovyan /home/jovyan \
@@ -46,35 +50,34 @@ RUN echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen \
4650
&& locale-gen en_US.utf8 \
4751
&& /usr/sbin/update-locale LANG=en_US.UTF-8
4852

49-
# set env variables for noninteractive
50-
ENV LC_ALL en_US.UTF-8
51-
ENV LANG en_US.UTF-8
52-
ENV TZ UTC
53-
5453
# install R and littler, and create a link for littler in /usr/local/bin
5554
# Default CRAN repo is now set by R itself, and littler knows about it too
5655
# r-cran-docopt is not currently in c2d4u so we install from source
5756
ARG DEBIAN_FRONTEND=noninteractive
5857
RUN apt-get update \
5958
&& apt-get install -y --no-install-recommends \
6059
littler \
61-
r-base \
62-
r-base-dev \
63-
r-recommended \
64-
&& ln -s /usr/lib/R/site-library/littler/examples/install.r /usr/local/bin/install.r \
65-
&& ln -s /usr/lib/R/site-library/littler/examples/install2.r /usr/local/bin/install2.r \
66-
&& ln -s /usr/lib/R/site-library/littler/examples/installGithub.r /usr/local/bin/installGithub.r \
67-
&& ln -s /usr/lib/R/site-library/littler/examples/testInstalled.r /usr/local/bin/testInstalled.r \
68-
&& install.r docopt \
69-
&& rm -rf /tmp/downloaded_packages/ /tmp/*.rds \
70-
&& rm -rf /var/lib/apt/lists/*
60+
r-base \
61+
r-base-dev \
62+
r-recommended \
63+
&& ln -s /usr/lib/R/site-library/littler/examples/install.r /usr/local/bin/install.r \
64+
&& ln -s /usr/lib/R/site-library/littler/examples/install2.r /usr/local/bin/install2.r \
65+
&& ln -s /usr/lib/R/site-library/littler/examples/installGithub.r /usr/local/bin/installGithub.r \
66+
&& ln -s /usr/lib/R/site-library/littler/examples/testInstalled.r /usr/local/bin/testInstalled.r \
67+
&& install.r docopt \
68+
&& rm -rf /tmp/downloaded_packages/ /tmp/*.rds \
69+
&& rm -rf /var/lib/apt/lists/*
7170

7271
# install system dependencies for suite of spatial R packages
7372
ARG DEBIAN_FRONTEND=noninteractive
74-
RUN apt-get update&&apt-get install -y apt-utils pkg-config
75-
RUN apt-get install -y libsqlite3-dev libudunits2-dev libssl-dev libmagick++-dev libcurl4-openssl-dev \
76-
libprotobuf-dev protobuf-compiler libv8-dev libjq-dev
77-
RUN apt-get update&&apt-get install -y --no-install-recommends r-cran-reticulate
73+
RUN add-apt-repository --yes "ppa:ubuntugis/ppa" \
74+
&& apt-get update \
75+
&& apt-get install -y apt-utils pkg-config \
76+
&& apt-get install -y libsqlite3-dev libssl-dev \
77+
libmagick++-dev libcurl4-openssl-dev \
78+
libprotobuf-dev protobuf-compiler libv8-dev libjq-dev \
79+
libudunits2-dev libgdal-dev libgeos-dev libproj-dev \
80+
&& apt-get install -y --no-install-recommends r-cran-reticulate
7881

7982
# install R packages
8083
RUN R -e 'install.packages(c("IRkernel", "rgdal", "sp", "raster", "sf", "basemaps", "ggplot2", "mapview", "mapedit", "devtools", "usethis", "testthat", "roxygen2", "geojsonio", "gdalUtils"))'
@@ -94,6 +97,6 @@ WORKDIR /notebooks
9497
#CMD bash -c " && rstudio-server start"
9598
#RUN "/init"
9699

97-
ENTRYPOINT ["/bin/tini", "--"] # "entrypoint.sh"
98-
CMD ["jupyter", "notebook", "--allow-root", "--ip='0.0.0.0'" "--NotebookApp.token='secretpassword'"]
100+
ENTRYPOINT ["/tini", "--"]
101+
CMD ["jupyter", "notebook", "--allow-root", "--ip='0.0.0.0'", "--NotebookApp.token='secretpassword'"]
99102
#CMD ["rstudio-server start"]

Dockerfile.old

+99
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
FROM ubuntu:focal
2+
3+
FROM opendatacube/geobase:wheels-3.0.4 as env_builder
4+
ARG py_env_path=/env
5+
6+
# set rpy2 to ABI mode, since R is installed after rpy2
7+
ENV RPY2_CFFI_MODE=ABI
8+
9+
# install required python libraries
10+
RUN mkdir -p /conf
11+
RUN pip3 install --upgrade pip
12+
COPY requirements.txt /conf/
13+
RUN env-build-tool new /conf/requirements.txt ${py_env_path} /wheels
14+
15+
# install ODC
16+
FROM opendatacube/geobase:runner-3.0.4
17+
ARG py_env_path=/env
18+
19+
COPY --chown=1000:100 --from=env_builder $py_env_path $py_env_path
20+
COPY --from=env_builder /bin/tini /bin/tini
21+
22+
RUN export GDAL_DATA=$(gdal-config --datadir)
23+
ENV LC_ALL=C.UTF-8 \
24+
PATH="/env/bin:$PATH"
25+
26+
RUN useradd -m -s /bin/bash -N jovyan -g 100 -u 1000 \
27+
&& chown jovyan /home/jovyan \
28+
&& addgroup jovyan staff
29+
30+
# install R dependencies
31+
RUN apt-get update \
32+
&& apt-get install -y --no-install-recommends \
33+
software-properties-common \
34+
dirmngr \
35+
ed \
36+
less \
37+
locales \
38+
vim-tiny \
39+
wget \
40+
ca-certificates \
41+
&& add-apt-repository --enable-source --yes "ppa:marutter/rrutter4.0" \
42+
&& add-apt-repository --enable-source --yes "ppa:c2d4u.team/c2d4u4.0+"
43+
44+
# configure default locale, see https://github.com/rocker-org/rocker/issues/19
45+
RUN echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen \
46+
&& locale-gen en_US.utf8 \
47+
&& /usr/sbin/update-locale LANG=en_US.UTF-8
48+
49+
# set env variables for noninteractive
50+
ENV LC_ALL en_US.UTF-8
51+
ENV LANG en_US.UTF-8
52+
ENV TZ UTC
53+
54+
# install R and littler, and create a link for littler in /usr/local/bin
55+
# Default CRAN repo is now set by R itself, and littler knows about it too
56+
# r-cran-docopt is not currently in c2d4u so we install from source
57+
ARG DEBIAN_FRONTEND=noninteractive
58+
RUN apt-get update \
59+
&& apt-get install -y --no-install-recommends \
60+
littler \
61+
r-base \
62+
r-base-dev \
63+
r-recommended \
64+
&& ln -s /usr/lib/R/site-library/littler/examples/install.r /usr/local/bin/install.r \
65+
&& ln -s /usr/lib/R/site-library/littler/examples/install2.r /usr/local/bin/install2.r \
66+
&& ln -s /usr/lib/R/site-library/littler/examples/installGithub.r /usr/local/bin/installGithub.r \
67+
&& ln -s /usr/lib/R/site-library/littler/examples/testInstalled.r /usr/local/bin/testInstalled.r \
68+
&& install.r docopt \
69+
&& rm -rf /tmp/downloaded_packages/ /tmp/*.rds \
70+
&& rm -rf /var/lib/apt/lists/*
71+
72+
# install system dependencies for suite of spatial R packages
73+
ARG DEBIAN_FRONTEND=noninteractive
74+
RUN apt-get update&&apt-get install -y apt-utils pkg-config
75+
RUN apt-get install -y libsqlite3-dev libudunits2-dev libssl-dev libmagick++-dev libcurl4-openssl-dev \
76+
libprotobuf-dev protobuf-compiler libv8-dev libjq-dev
77+
RUN apt-get update&&apt-get install -y --no-install-recommends r-cran-reticulate
78+
79+
# install R packages
80+
RUN R -e 'install.packages(c("IRkernel", "rgdal", "sp", "raster", "sf", "basemaps", "ggplot2", "mapview", "mapedit", "devtools", "usethis", "testthat", "roxygen2", "geojsonio", "gdalUtils"))'
81+
RUN R -e 'devtools::install_github("eo2cube/odcr")'
82+
RUN R -e 'install.packages(c("IRkernel"))'
83+
84+
# initiliaze R kernel for Jupyter
85+
RUN R -e "IRkernel::installspec(user = FALSE)"
86+
87+
## automatically link a shared volume for kitematic users
88+
#VOLUME /home/rstudio/kitematic
89+
90+
# set user and working dir
91+
USER jovyan
92+
WORKDIR /notebooks
93+
94+
#CMD bash -c " && rstudio-server start"
95+
#RUN "/init"
96+
97+
ENTRYPOINT ["/bin/tini", "--"] # "entrypoint.sh"
98+
CMD ["jupyter", "notebook", "--allow-root", "--ip='0.0.0.0'" "--NotebookApp.token='secretpassword'"]
99+
#CMD ["rstudio-server start"]

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Make sure to have [`docker`](https://docs.docker.com/engine/install/ubuntu/#inst
2525
Clone this repository to a directory of your choice, e.g. using
2626

2727
```
28-
git clone https://github.com/16EAGLE/odcbox/
28+
git clone https://github.com/eo2cube/odcbox/
2929
```
3030

3131
and `cd` into its main directory. To start the container (and build it the first time), run:

notebooks/r_s2_odc_example.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1648,7 +1648,7 @@
16481648
"mimetype": "text/x-r-source",
16491649
"name": "R",
16501650
"pygments_lexer": "r",
1651-
"version": "4.1.0"
1651+
"version": "4.1.2"
16521652
}
16531653
},
16541654
"nbformat": 4,

requirements.txt

+7-6
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,22 @@ odc-apps-cloud
1212
odc-apps-dc-tools
1313
odc-ui
1414
odc-index
15-
# Pinned for Alex to index STAC.
16-
sat-search==0.3.0
15+
#sat-search==0.3.0
1716
# Jupyter components.
1817
gdal
1918
scipy
2019
jupyter==1.0.0
21-
jupyterlab==2.2.6
22-
ipyleaflet==0.13.0
20+
jupyterlab==3.2.0
21+
ipyleaflet==0.14.0
2322
folium
24-
pandas==1.0.5
23+
pandas==1.3.4
24+
numpy==1.18
2525
xarray==0.16.0
26-
matplotlib==3.2.1
26+
matplotlib==3.4.3
2727
geopandas
2828
scikit-image
2929
tqdm
3030
click<8.0.0
31+
python-dateutil==2.7.5
3132
dataclasses
3233
rpy2

requirements.txt.old

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
--extra-index-url https://packages.dea.ga.gov.au/
2+
aiohttp
3+
aiobotocore[boto3,awscli]==1.0.7
4+
pyyaml
5+
wget
6+
requests
7+
datacube
8+
odc-algo
9+
odc-aws
10+
odc-aio
11+
odc-apps-cloud
12+
odc-apps-dc-tools
13+
odc-ui
14+
odc-index
15+
# Pinned for Alex to index STAC.
16+
sat-search==0.3.0
17+
# Jupyter components.
18+
gdal
19+
scipy
20+
jupyter==1.0.0
21+
jupyterlab==2.2.6
22+
ipyleaflet==0.13.0
23+
folium
24+
pandas==1.0.5
25+
xarray==0.16.0
26+
matplotlib==3.2.1
27+
geopandas
28+
scikit-image
29+
tqdm
30+
click<8.0.0
31+
dataclasses
32+
rpy2

0 commit comments

Comments
 (0)