Jelajahi Sumber

added singularity file

Luca Delucchi 5 tahun lalu
induk
melakukan
7740ed311f
2 mengubah file dengan 187 tambahan dan 0 penghapusan
  1. 38 0
      singularity/debian/README_debian.md
  2. 149 0
      singularity/debian/singularityfile_debian

+ 38 - 0
singularity/debian/README_debian.md

@@ -0,0 +1,38 @@
+# Singularity GRASS GIS (Debian Linux)
+
+Singularityfile with an [Debian Linux](https://www.debian.org/) image with [GRASS GIS](https://grass.osgeo.org/),
+[PDAL](https://pdal.io) support and [grass-session](https://github.com/zarch/grass-session/).
+
+Download size of this image is of approximately 560 MB.
+
+Clone this repository and change directory:
+
+```bash
+$ git clone https://github.com/OSGeo/grass.git
+$ cd grass
+```
+
+__Build the singularity with__:
+
+```bash
+$ sudo singularity build grass_master.simg singularity/debian/singularity_debian
+```
+
+The image can be used as:
+
+```bash
+$ singularity exec containers/grass_7.8.simg grass --version
+```
+
+__To build a stable version__:
+
+change to the releasebranch or tag you want to build:
+```bash
+$ git checkout remotes/origin/releasebranch_7_8
+```
+
+and build and enter with:
+
+```bash
+$ sudo singularity build grass_7_8.simg singularity/debian/singularity_debian
+```

+ 149 - 0
singularity/debian/singularityfile_debian

@@ -0,0 +1,149 @@
+Bootstrap: docker
+From: debian:bullseye
+
+%help
+Singularity container for GRASS GIS to be run into GRASS main directory
+
+%labels
+  Maintainer Luca Delucchi
+
+%setup
+  mkdir /tmp/grass_build
+
+%files
+  . /tmp/grass_build
+
+%post
+    # Install useful libraries
+    apt-get -y update
+    apt-get -y install \
+        build-essential \
+        bison \
+        bzip2 \
+        cmake \
+        curl \
+        flex \
+        g++ \
+        gcc \
+        gdal-bin \
+        gettext \
+        git \
+        libbz2-dev \
+        libcairo2 \
+        libcairo2-dev \
+        libcurl4-gnutls-dev \
+        libfftw3-bin \
+        libfftw3-dev \
+        libfreetype6-dev \
+        libgdal-dev \
+        libgeos-dev \
+        libgsl-dev \
+        libjpeg-dev \
+        libjsoncpp-dev \
+        libopenblas-base \
+        libopenblas-dev \
+        libnetcdf-dev \
+        libncurses5-dev \
+        libopenjp2-7 \
+        libopenjp2-7-dev \
+        libpdal-dev \
+        libpnglite-dev \
+        libpq-dev \
+        libpython3-all-dev \
+        libreadline-dev \
+        libsqlite3-dev \
+        libtiff-dev \
+        libzstd-dev \
+        make \
+        mesa-common-dev \
+        moreutils \
+        ncurses-bin \
+        netcdf-bin \
+        pdal \
+        python3 \
+        python3-dateutil \
+        python3-dev \
+        python3-gdal \
+        python3-magic \
+        python3-numpy \
+        python3-pdal \
+        python3-pil \
+        python3-pip \
+        python3-ply \
+        python3-requests \
+        python3-setuptools \
+        python3-venv \
+        software-properties-common \
+        sqlite3 \
+        subversion \
+        unzip \
+        vim \
+        wget \
+        zip \
+        zlib1g-dev
+
+    # Set Python 3 as default Python version
+    update-alternatives --install /usr/bin/python python /usr/bin/python3 1
+    echo LANG="en_US.UTF-8" > /etc/default/locale
+    # compile GRASS
+    cd /tmp/grass_build
+    # -O2 -march=native -std=gnu99 -m64
+    LDFLAGS="-s"
+    CFLAGS="-O2 -march=x86-64 -std=gnu99 -m64"
+    CXXFLAGS="-O2"
+    GRASS_PYTHON=/usr/bin/python3
+    ./configure \
+        --enable-largefile \
+        --with-cxx \
+        --with-nls \
+        --with-readline \
+        --with-sqlite \
+        --with-bzlib \
+        --with-zstd \
+        --with-cairo \
+        --with-cairo-ldflags=-lfontconfig \
+        --with-freetype \
+        --with-freetype-includes="/usr/include/freetype2/" \
+        --with-fftw \
+        --with-netcdf \
+        --with-pdal \
+        --with-proj \
+        --with-proj-share=/usr/share/proj \
+        --with-geos=/usr/bin/geos-config \
+        --with-postgres \
+        --with-postgres-includes="/usr/include/postgresql" \
+        --without-mysql \
+        --without-odbc \
+        --without-openmp \
+        --without-ffmpeg \
+        --without-opengl
+	make -j 2 && make install && ldconfig
+    # Create generic GRASS GIS binary name regardless of version number
+    ln -sf `find /usr/local/bin -name "grass??" | sort | tail -n 1` /usr/local/bin/grass
+    ln -sf `find /usr/local -type d -name "grass??" | sort | tail -n 1` /usr/local/grass
+    # Remove unused file
+    apt-get autoremove -y
+    apt-get clean -y
+    cd /tmp
+    rm -rf /src/grass_build
+    # Add useful GRASS addons
+    grass -c EPSG:4326 --tmp-location --exec g.extension -s ext=i.modis
+    grass -c EPSG:4326 --tmp-location --exec g.extension -s ext=i.sentinel
+    grass -c EPSG:4326 --tmp-location --exec g.extension -s ext=r.in.pdal
+    #grass -c EPSG:4326 --tmp-location --exec g.extension -s ext=i.wi
+    #grass -c EPSG:4326 --tmp-location --exec g.extension -s ext=r.bioclim
+    #grass -c EPSG:4326 --tmp-location --exec g.extension -s ext=r.series.lwr
+    #grass -c EPSG:4326 --tmp-location --exec g.extension -s ext=v.clip
+    #grass -c EPSG:4326 --tmp-location --exec g.extension -s ext=v.strds.stats
+
+    # Add Python GRASS session
+    pip3 install grass-session
+
+%environment
+    export LANG=C.UTF-8
+    export LC_ALL=C.UTF-8
+    export SHELL=/bin/bash
+    export LD_LIBRARY_PATH="/usr/local/lib"
+
+%runscript
+    grass --version