├── Dockerfile ├── Makefile ├── README.md ├── gdal-checkout.txt └── grass-checkout.txt /Dockerfile: -------------------------------------------------------------------------------- 1 | ## 2 | # geodata/grass 3 | # 4 | # This creates an Ubuntu derived base image that installs GRASS from a specific 5 | # subversion checkout compiled against a specific GDAL version. 6 | # 7 | 8 | # Ubuntu 14.04 Trusty Tahyr 9 | FROM ubuntu:trusty 10 | 11 | MAINTAINER Homme Zwaagstra 12 | 13 | # Install the application. 14 | ADD . /usr/local/src/grass-docker/ 15 | RUN apt-get update -y && \ 16 | apt-get install -y make && \ 17 | make -C /usr/local/src/grass-docker install clean && \ 18 | apt-get purge -y make 19 | 20 | # Externally accessible data is by default put in /data. 21 | WORKDIR /data 22 | VOLUME ["/data"] 23 | 24 | # Ensure the SHELL is picked up by grass. 25 | ENV SHELL /bin/bash 26 | 27 | # All commands are executed by grass. 28 | ENTRYPOINT ["grass"] 29 | 30 | # Output GRASS version by default. 31 | CMD ["--help] 32 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | ## 2 | # Install GRASS from within a docker container 3 | # 4 | # This Makefile is designed to be run from within a docker container in order to 5 | # install GRASS. The following is an example invocation: 6 | # 7 | # make -C /usr/local/src/grass-docker install clean 8 | # 9 | # The targets in this Makefile are derived from instructions at 10 | # and the Travis CI 11 | # `.travis.yml` file in the repository. 12 | # 13 | 14 | # Version related variables. 15 | GRASS_VERSION := $(shell cat ./grass-checkout.txt) 16 | GDAL_VERSION := $(shell cat ./gdal-checkout.txt) 17 | 18 | # Buildtime dependencies satisfied by packages. 19 | BUILD_PACKAGES := build-essential \ 20 | flex bison cmake ccache \ 21 | checkinstall 22 | 23 | # Runtime dependencies satisfied by packages. 24 | DEPS_PACKAGES := python python-dev \ 25 | python-dateutil libgsl0-dev python-numpy \ 26 | python-opengl \ 27 | python-wxversion python-wxtools python-wxgtk2.8 \ 28 | python-dateutil libgsl0-dev python-numpy \ 29 | wx2.8-headers wx-common libwxgtk2.8-dev libwxgtk2.8-dbg \ 30 | libwxbase2.8-dev libwxbase2.8-dbg \ 31 | libncurses5-dev \ 32 | zlib1g-dev gettext \ 33 | libtiff-dev libpnglite-dev \ 34 | libcairo2 libcairo2-dev \ 35 | sqlite3 libsqlite3-dev \ 36 | libpq-dev \ 37 | libreadline6 libreadline6-dev libfreetype6-dev \ 38 | libfftw3-3 libfftw3-dev \ 39 | libboost-thread-dev libboost-program-options-dev liblas-c-dev \ 40 | resolvconf \ 41 | libjasper-dev \ 42 | libav-tools libavutil-dev ffmpeg2theora \ 43 | libffmpegthumbnailer-dev \ 44 | libavcodec-dev \ 45 | libxmu-dev \ 46 | libavformat-dev libswscale-dev \ 47 | libglu1-mesa-dev libxmu-dev \ 48 | ghostscript \ 49 | libmysqlclient-dev \ 50 | netcdf-bin libnetcdf-dev 51 | 52 | # GRASS dependency targets. 53 | GRASS := /usr/local/bin/grass 54 | GDAL_CONFIG := /usr/local/bin/gdal_config 55 | BUILD_ESSENTIAL := /usr/share/build-essential 56 | MAN := /usr/bin/man 57 | 58 | # Build tools. 59 | SVN := /usr/bin/svn 60 | GIT := /usr/bin/git 61 | 62 | install: $(GRASS) 63 | 64 | $(GRASS): /tmp/grass $(BUILD_ESSENTIAL) $(GDAL_CONFIG) $(MAN) 65 | cd /tmp/grass/ \ 66 | && CFLAGS="-O2 -Wall" LDFLAGS="-s" ./configure \ 67 | --enable-largefile=yes \ 68 | --with-nls \ 69 | --with-cxx \ 70 | --with-readline \ 71 | --with-pthread \ 72 | --with-proj-share=/usr/share/proj \ 73 | --with-geos \ 74 | --with-wxwidgets \ 75 | --with-cairo \ 76 | --with-opengl-libs=/usr/include/GL \ 77 | --with-freetype=yes --with-freetype-includes="/usr/include/freetype2/" \ 78 | --with-postgres=yes --with-postgres-includes="/usr/include/postgresql" \ 79 | --with-sqlite=yes \ 80 | --with-mysql=yes --with-mysql-includes="/usr/include/mysql" \ 81 | --with-odbc=yes \ 82 | --with-netcdf=yes \ 83 | --with-liblas=yes \ 84 | && make -j$$(nproc) \ 85 | && make install \ 86 | && export WITH_GRASS=/usr/local/grass-$$(head -3 /tmp/grass/include/VERSION | tr "\n" . | sed 's/\.$$//') \ 87 | && echo "$${WITH_GRASS}/lib" > /etc/ld.so.conf.d/grass.conf \ 88 | && ldconfig \ 89 | && ln -fs /usr/local/bin/grass$$(head -2 /tmp/grass/include/VERSION | tr -d "\n") $(GRASS) \ 90 | && touch -c -r /tmp/apt-updated $(GDAL_CONFIG) \ 91 | && make -C /usr/local/src/gdal-docker install WITH_GRASS=$$WITH_GRASS \ 92 | && touch -c $(GDAL_CONFIG) $(GRASS) 93 | 94 | $(GDAL_CONFIG): /usr/local/src/gdal-docker 95 | make -C /usr/local/src/gdal-docker install \ 96 | && touch -c $(GDAL_CONFIG) 97 | /usr/local/src/gdal-docker: $(GIT) 98 | $(GIT) clone --branch $(GDAL_VERSION) --depth 1 http://github.com/geo-data/gdal-docker /usr/local/src/gdal-docker \ 99 | && touch -c /usr/local/src/gdal-docker 100 | 101 | /tmp/grass: $(SVN) 102 | $(SVN) checkout --quiet "http://svn.osgeo.org/grass/grass/$(GRASS_VERSION)/" /tmp/grass/ \ 103 | && touch -c /tmp/grass 104 | 105 | $(MAN): /tmp/apt-updated 106 | apt-get install -y man && touch -c $(MAN) 107 | 108 | $(SVN): /tmp/apt-updated 109 | apt-get install -y subversion && touch -c $(SVN) 110 | 111 | $(GIT): /tmp/apt-updated 112 | apt-get install -y git && touch -c $(GIT) 113 | 114 | $(BUILD_ESSENTIAL): /tmp/apt-updated 115 | apt-get install -y $(BUILD_PACKAGES) $(DEPS_PACKAGES) \ 116 | && touch -c $(BUILD_ESSENTIAL) 117 | 118 | /tmp/apt-updated: 119 | apt-get update -y && touch /tmp/apt-updated 120 | 121 | # Remove build time dependencies. 122 | clean: 123 | make -C /usr/local/src/gdal-docker clean \ 124 | && apt-get purge -y \ 125 | $(BUILD_PACKAGES) \ 126 | subversion \ 127 | git \ 128 | && apt-get autoremove -y \ 129 | && apt-get clean \ 130 | && rm -rf /var/lib/apt/lists/partial/* /tmp/* /var/tmp/* 131 | 132 | .PHONY: install clean 133 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GRASS Docker Images 2 | 3 | This is an Ubuntu derived image containing [GRASS GIS](http://grass.osgeo.org) 4 | software. 5 | 6 | Each branch in the git repository corresponds to a GRASS major version 7 | (e.g. `7.0`) with the master branch following GRASS trunk. These branch names 8 | are reflected in the image tags on the Docker Index (e.g. branch `7.0` 9 | corresponds to the image `geodata/grass:7.0`). 10 | 11 | ## Usage 12 | 13 | Running the container without any arguments will output the grass help: 14 | 15 | docker run geodata/grass 16 | 17 | All arguments passed to the image are passed as options to grass, i.e. the 18 | following is equivalent to the previous invocation: 19 | 20 | docker run geodata/grass --help 21 | 22 | You will most likely want to work with data on the host system from within the 23 | docker container, in which case run the container with the `-v` option along the 24 | following lines: 25 | 26 | docker run -it --rm -v $(pwd):/data geodata/grass -c /data/grassdb/here 27 | 28 | The above command will create, in the current working directory on the host, the 29 | GRASS database `grassdb` and the GRASS location `here` with the default GRASS 30 | mapset of `PERMANENT`. 31 | 32 | Running the following command in the future **from the same current working 33 | directory** will allow you to continue working with the data: 34 | 35 | docker run -it --rm -v $(pwd):/data geodata/grass /data/grassdb/here/PERMANENT 36 | 37 | This works because the current working directory is set to `/data` in 38 | the container, and you have mapped the current working directory on your host to 39 | `/data`. 40 | 41 | ## Creating images with specific versions 42 | 43 | You may want to create your own images based on specific versions of GRASS and 44 | GDAL, in which case clone the GRASS docker repository and edit the 45 | `grass-checkout.txt` and `gdal-checkout.txt` files to reference the desired 46 | versions. For example, the following will build GRASS 7.0.0 against GDAL 2.0.0: 47 | 48 | ``` 49 | git clone git://github.com/geo-data/grass-docker/ \ 50 | && cd grass-docker \ 51 | && echo "tags/release_20150220_grass_7_0_0" > grass-checkout.txt \ 52 | && echo "2.0.0" > gdal-checkout.txt \ 53 | && docker build -t geodata/grass:local . 54 | ``` 55 | 56 | `tags/release_20150220_grass_7_0_0` references a specific checkout of the 57 | [GRASS subversion repository](https://svn.osgeo.org/grass/grass/). 58 | 59 | Note that the image tagged `geodata/grass:latest` represents the latest code *at 60 | the time the image was built*. If you want to include the most up-to-date 61 | commits then you need to build the docker image yourself locally along these 62 | lines: 63 | 64 | docker build -t geodata/grass:local git://github.com/geo-data/grass-docker/ 65 | -------------------------------------------------------------------------------- /gdal-checkout.txt: -------------------------------------------------------------------------------- 1 | master 2 | -------------------------------------------------------------------------------- /grass-checkout.txt: -------------------------------------------------------------------------------- 1 | trunk 2 | --------------------------------------------------------------------------------