Dockerfile 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. FROM ubuntu:18.04
  2. LABEL authors="Vaclav Petras,Markus Neteler"
  3. LABEL maintainer="wenzeslaus@gmail.com,neteler@osgeo.org"
  4. # system environment
  5. ENV DEBIAN_FRONTEND noninteractive
  6. # data directory - not using the base images volume because then the permissions cannot be adapted
  7. ENV DATA_DIR /data
  8. # GRASS GIS compile dependencies
  9. RUN apt-get update \
  10. && apt-get install -y --no-install-recommends --no-install-suggests \
  11. build-essential \
  12. libblas-dev \
  13. libbz2-dev \
  14. libcairo2-dev \
  15. libfftw3-dev \
  16. libfreetype6-dev \
  17. libgdal-dev \
  18. libgeos-dev \
  19. libglu1-mesa-dev \
  20. libgsl0-dev \
  21. libjpeg-dev \
  22. liblapack-dev \
  23. liblas-dev \
  24. liblas-c-dev \
  25. libncurses5-dev \
  26. libnetcdf-dev \
  27. libopenjp2-7 \
  28. libopenjp2-7-dev \
  29. libpdal-dev pdal \
  30. libpdal-plugin-python \
  31. libpng-dev \
  32. libpq-dev \
  33. libproj-dev \
  34. libreadline-dev \
  35. libsqlite3-dev \
  36. libtiff-dev \
  37. libxmu-dev \
  38. libzstd-dev \
  39. bison \
  40. flex \
  41. g++ \
  42. gettext \
  43. gdal-bin \
  44. libfftw3-bin \
  45. make \
  46. ncurses-bin \
  47. netcdf-bin \
  48. proj-bin \
  49. proj-data \
  50. python \
  51. python-dev \
  52. python-numpy \
  53. python-pil \
  54. python-ply \
  55. python-six \
  56. sqlite3 \
  57. subversion \
  58. unixodbc-dev \
  59. zlib1g-dev \
  60. && apt-get autoremove \
  61. && apt-get clean && \
  62. mkdir -p $DATA_DIR
  63. RUN echo LANG="en_US.UTF-8" > /etc/default/locale
  64. ENV LANG C.UTF-8
  65. ENV LC_ALL C.UTF-8
  66. RUN mkdir /code
  67. RUN mkdir /code/grass
  68. # add repository files to the image
  69. COPY . /code/grass
  70. WORKDIR /code/grass
  71. # Set gcc/g++ environmental variables for GRASS GIS compilation, without debug symbols
  72. ENV MYCFLAGS "-O2 -std=gnu99 -m64"
  73. ENV MYLDFLAGS "-s"
  74. # CXX stuff:
  75. ENV LD_LIBRARY_PATH "/usr/local/lib"
  76. ENV LDFLAGS "$MYLDFLAGS"
  77. ENV CFLAGS "$MYCFLAGS"
  78. ENV CXXFLAGS "$MYCXXFLAGS"
  79. # Configure, compile and install GRASS GIS
  80. ENV NUMTHREADS=2
  81. RUN ./configure \
  82. --enable-largefile \
  83. --with-cxx \
  84. --with-nls \
  85. --with-readline \
  86. --with-sqlite \
  87. --with-bzlib \
  88. --with-zstd \
  89. --with-cairo --with-cairo-ldflags=-lfontconfig \
  90. --with-freetype --with-freetype-includes="/usr/include/freetype2/" \
  91. --with-fftw \
  92. --with-netcdf \
  93. --with-liblas --with-liblas-config=/usr/bin/liblas-config \
  94. --with-pdal \
  95. --with-proj --with-proj-share=/usr/share/proj \
  96. --with-geos=/usr/bin/geos-config \
  97. --with-postgres --with-postgres-includes="/usr/include/postgresql" \
  98. --with-opengl-libs=/usr/include/GL \
  99. && make -j $NUMTHREADS && make install && ldconfig
  100. # enable simple grass command regardless of version number
  101. RUN ln -s /usr/local/bin/grass* /usr/local/bin/grass
  102. # Reduce the image size
  103. RUN apt-get autoremove -y
  104. RUN apt-get clean -y
  105. # set SHELL var to avoid /bin/sh fallback in interactive GRASS GIS sessions in docker
  106. ENV SHELL /bin/bash
  107. # Fix permissions
  108. RUN chmod -R a+rwx $DATA_DIR
  109. # create a user
  110. RUN useradd -m -U grass
  111. # declare data volume late so permissions apply
  112. VOLUME $DATA_DIR
  113. WORKDIR $DATA_DIR
  114. # Further reduce the docker image size
  115. RUN rm -rf /code/grass
  116. # switch the user
  117. USER grass
  118. CMD ["/usr/local/bin/grass", "--version"]