[GRASS-SVN] r71875 - grass/trunk

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Nov 30 05:03:32 PST 2017


Author: neteler
Date: 2017-11-30 05:03:32 -0800 (Thu, 30 Nov 2017)
New Revision: 71875

Modified:
   grass/trunk/Dockerfile
   grass/trunk/README
Log:
docker: fix write access of volume management; update docker usage instructions

Modified: grass/trunk/Dockerfile
===================================================================
--- grass/trunk/Dockerfile	2017-11-29 21:35:25 UTC (rev 71874)
+++ grass/trunk/Dockerfile	2017-11-30 13:03:32 UTC (rev 71875)
@@ -5,6 +5,9 @@
 # system environment
 ENV DEBIAN_FRONTEND noninteractive
 
+# data directory - not using the base images volume because then the permissions cannot be adapted
+ENV DATA_DIR /data
+
 # GRASS GIS compile dependencies
 RUN apt-get update \
     && apt-get install -y --install-recommends \
@@ -45,7 +48,8 @@
         unixodbc-dev \
         zlib1g-dev \
     && apt-get autoremove \
-    && apt-get clean
+    && apt-get clean && \
+    mkdir -p $DATA_DIR
 
 RUN mkdir /code
 RUN mkdir /code/grass
@@ -70,17 +74,22 @@
     --with-freetype=yes --with-freetype-includes="/usr/include/freetype2/" \
     --with-sqlite=yes \
     --with-liblas=yes --with-liblas-config=/usr/bin/liblas-config \
-    && make && make install && ldconfig
+    && make -j2 && make install && ldconfig
 
 # enable simple grass command regardless of version number
 RUN ln -s /usr/local/bin/grass* /usr/local/bin/grass
 
+# Fix permissions
+RUN chmod -R a+rwx $DATA_DIR
+
 # create a user
 RUN useradd -m -U grass
 
-VOLUME ["/data"]
+# declare volume late so permissions apply
+VOLUME $DATA_DIR
+WORKDIR $DATA_DIR
 
 # switch the user
 USER grass
 
-WORKDIR /data
+CMD ["/usr/local/bin/grass", "--version"]

Modified: grass/trunk/README
===================================================================
--- grass/trunk/README	2017-11-29 21:35:25 UTC (rev 71874)
+++ grass/trunk/README	2017-11-30 13:03:32 UTC (rev 71875)
@@ -55,24 +55,30 @@
 Build using the downloaded source code (in the directory with the
 source code):
 
-    docker build -t grass .
+    docker build -t grassgis75 .
 
-A test run (assuming you have existing GRASS GIS location)
+A test run (assuming you have existing GRASS GIS location; it can be downloaded from
+https://grass.osgeo.org/sampledata/north_carolina/nc_basic_spm_grass7.zip)
 
-    docker run --rm -v /your/local/grassdata/:/data -it grass \
+    # case 1: launching in the grassdata directory in which the location is stored:
+    docker run -it --rm --user=$(id -u):$(id -g) --volume $(pwd):/data --env HOME=/data/ grassgis75 \
+        grass --text nc_spm_08_grass7/user1 --exec g.region -p
+
+    # case 2: launching anywhere
+    docker run -it --rm --user=$(id -u):$(id -g) --volume /your/test/grassdata/:/data --env HOME=/data/ grassgis75 \
         grass /data/nc_basic_spm/PERMANENT --exec g.region -p
 
-Note that the first `grass` is a name of the image while the second
+Note that the first `grassgis75` is the name of the image while the second
 `grass` is the name of the executable.
 
 To run the tests (again assuming local location):
 
-    docker run --rm -v /your/test/grassdata/:/data -w /code/grass \
-        -it grass grass /data/nc_basic_spm/PERMANENT --exec \
+    docker run -it --rm --user=$(id -u):$(id -g) --volume /your/test/grassdata/:/data --env HOME=/data/ -w /code/grass \
+        grassgis75 grass /data/nc_basic_spm/PERMANENT --exec \
             python -m grass.gunittest.main \
                 --location nc_basic_spm --location-type nc
 
-If you compiled locally before building the Docker image, you may
+Note: If you compiled locally before building the Docker image, you may
 encounter problems as the local configuration and locally compiled file
 are copied to and used in the Docker image. To make sure you don't have
 this issue, clean all the compiled files from the source code:



More information about the grass-commit mailing list