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://gcr.hrz.tu-chemnitz.de/ioer/fdz/carto-lab-docker:grass) or the public quay.io-clone (quay.io/ioer-fdz/carto-lab-docker:grass). If you want the latest or specific versions, you have to build the image yourself.

Usage

Add the GRASS flavor overlay to your .env file:

COMPOSE_FILE=docker-compose.yml:docker-compose.grass.yml
COMPOSE_PATH_SEPARATOR=:

Then start the container:

docker compose up -d
Have a look at the docker-compose.grass.yml

services:
  jupyterlab:
    image: quay.io/ioer-fdz/carto-lab-docker:${TAG:-grass}
    build:
      context: ./grass
      args:
        VERSION: ${TAG:-latest}
See the grass/Dockerfilefile for the list of Grass dependencies

ARG VERSION=latest

## public:
# FROM quay.io/ioer-fdz/carto-lab-docker:$VERSION
## private:
FROM gcr.hrz.tu-chemnitz.de/ioer/fdz/carto-lab-docker:$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 and run:

docker compose -f docker-compose.yml -f docker-compose.grass.yml build \
    --no-cache --progress=plain \
  && docker compose -f docker-compose.yml -f docker-compose.grass.yml up -d

Optionally push to a registry:

docker compose -f docker-compose.yml -f docker-compose.grass.yml push

Example Jupyter notebook

See this Jupyter notebook for an example of working with GRASS Gis in Carto-Lab Docker (a viewshed analysis).