GRASS¶
If you want to use GRASS GIS together with its jupyter companion (grass.jupyter package), we prepared a Dockerfile
for you. The image extends the base image.
We occasionally push docker images for the GRASS tag to our registry (https://registry.gitlab.vgiscience.org/lbsn/tools/jupyterlab:grass
). If you want the latest or specific versions, you have to build the image yourself.
Use the following docker-compose.grass.yml
:
services:
jupyterlab:
image: registry.gitlab.vgiscience.org/lbsn/tools/jupyterlab:grass
build:
context: ./grass
args:
- APP_VERSION=${APP_VERSION:-latest}
container_name: ${CONTAINER_NAME:-lbsn-jupyterlab}
restart: "no"
ports:
- 127.0.0.1:${JUPYTER_WEBPORT:-8888}:8888
volumes:
- ${JUPYTER_NOTEBOOKS:-~/notebooks}:/home/jovyan/work
- ${CONDA_ENVS:-~/envs}:/envs
environment:
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-eX4mP13p455w0Rd}
- JUPYTER_PASSWORD=${JUPYTER_PASSWORD:-eX4mP13p455w0Rd}
- JUPYTER_WEBURL=${JUPYTER_WEBURL:-http://localhost:8888}
env_file: ".env"
networks:
- lbsn-network
networks:
lbsn-network:
name: ${NETWORK_NAME:-lbsn-network}
external: true
See the grass/Dockerfile
file for the list of Grass dependencies.
ARG APP_VERSION=latest
FROM registry.gitlab.vgiscience.org/lbsn/tools/jupyterlab:$APP_VERSION
ENV PYTHON_BINDINGS=" \
gdal-bin \
python3 \
python3-pip \
python3-psycopg2 \
python3-yaml \
grass" \
## GRASS GIS: Make sure the distro's python is used
GRASS_PYTHON=/usr/bin/python3
RUN apt-get update \
&& apt install -y --no-install-recommends \
$PYTHON_BINDINGS
ENV GRASS_BINDINGS=" \
autoconf2.13 \
autotools-dev \
bison \
flex \
g++ \
gettext \
git \
imagemagick \
libblas-dev \
libbz2-dev \
libcairo2-dev \
libfftw3-dev \
libfreetype6-dev \
libgdal-dev \
libgeos-dev \
libglu1-mesa-dev \
libjpeg-dev \
liblapack-dev \
libncurses5-dev \
libnetcdf-dev \
libpng-dev \
libpq-dev \
libproj-dev \
libreadline-dev \
libsqlite3-dev \
libtiff-dev \
libxmu-dev \
libzstd-dev \
make \
netcdf-bin \
p7zip \
proj-bin \
sqlite3 \
unixodbc-dev \
xvfb \
zlib1g-dev \
parallel"
RUN apt-get update \
&& apt install -y --no-install-recommends \
$GRASS_BINDINGS
RUN cd ~ \
&& git clone --depth 1 https://github.com/libLAS/libLAS.git liblas \
&& cd liblas \
&& mkdir makefiles \
&& cd makefiles \
&& apt install cmake -y --no-install-recommends \
&& apt install -y --no-install-recommends build-essential cmake libboost-dev libboost-serialization-dev \
libboost-filesystem-dev libboost-iostreams-dev libboost-program-options-dev \
zlib1g-dev rapidjson-dev libquadmath0 \
&& apt-get install libboost-thread-dev -y --no-install-recommends \
&& cmake -G "Unix Makefiles" ../ \
&& make \
&& make install
RUN /opt/conda/envs/worker_env/bin/python -m pip install folium
Building the image¶
Build:
docker compose -f docker-compose.grass.yml build \
--no-cache --progress=plain \
&& docker compose -f docker-compose.grass.yml up -d
Optionally push to a registry:
docker compose -f docker-compose.grass.yml push
Run the image¶
Run:
docker compose -f docker-compose.grass.yml up -d
Example Jupyter notebook¶
See this Jupyter notebook for an example of working with GRASS Gis in Carto-Lab Docker (a viewshed analysis).