Dockerfile 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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. libncurses5-dev \
  24. libnetcdf-dev \
  25. libopenjp2-7 \
  26. libopenjp2-7-dev \
  27. libpdal-dev pdal \
  28. libpdal-plugin-python \
  29. libpng-dev \
  30. libpq-dev \
  31. libproj-dev \
  32. libreadline-dev \
  33. libsqlite3-dev \
  34. libtiff-dev \
  35. libxmu-dev \
  36. libzstd-dev \
  37. bison \
  38. flex \
  39. g++ \
  40. gettext \
  41. gdal-bin \
  42. language-pack-en-base \
  43. libfftw3-bin \
  44. make \
  45. ncurses-bin \
  46. netcdf-bin \
  47. proj-bin \
  48. proj-data \
  49. python3 \
  50. python3-dateutil \
  51. python3-dev \
  52. python3-numpy \
  53. python3-pil \
  54. python3-pip \
  55. python3-ply \
  56. python3-six \
  57. python3-wxgtk4.0 \
  58. python3-gdal \
  59. python3-matplotlib \
  60. sqlite3 \
  61. subversion \
  62. unixodbc-dev \
  63. zlib1g-dev \
  64. && apt-get autoremove \
  65. && apt-get clean && \
  66. mkdir -p $DATA_DIR
  67. RUN echo LANG="en_US.UTF-8" > /etc/default/locale
  68. ENV LANG C.UTF-8
  69. ENV LC_ALL C.UTF-8
  70. RUN mkdir /code
  71. RUN mkdir /code/grass
  72. # add repository files to the image
  73. COPY . /code/grass
  74. WORKDIR /code/grass
  75. # Set gcc/g++ environmental variables for GRASS GIS compilation, without debug symbols
  76. ENV MYCFLAGS "-O2 -std=gnu99 -m64"
  77. ENV MYLDFLAGS "-s"
  78. # CXX stuff:
  79. ENV LD_LIBRARY_PATH "/usr/local/lib"
  80. ENV LDFLAGS "$MYLDFLAGS"
  81. ENV CFLAGS "$MYCFLAGS"
  82. ENV CXXFLAGS "$MYCXXFLAGS"
  83. # Configure, compile and install GRASS GIS
  84. ENV NUMTHREADS=2
  85. RUN ./configure \
  86. --enable-largefile \
  87. --with-cxx \
  88. --with-nls \
  89. --with-readline \
  90. --with-sqlite \
  91. --with-bzlib \
  92. --with-zstd \
  93. --with-cairo --with-cairo-ldflags=-lfontconfig \
  94. --with-freetype --with-freetype-includes="/usr/include/freetype2/" \
  95. --with-fftw \
  96. --with-netcdf \
  97. --with-pdal \
  98. --with-proj --with-proj-share=/usr/share/proj \
  99. --with-geos=/usr/bin/geos-config \
  100. --with-postgres --with-postgres-includes="/usr/include/postgresql" \
  101. --with-opengl-libs=/usr/include/GL \
  102. && make -j $NUMTHREADS && make install && ldconfig
  103. # enable simple grass command regardless of version number
  104. RUN if [ ! -e /usr/local/bin/grass ] ; then ln -s /usr/local/bin/grass* /usr/local/bin/grass ; fi
  105. # Reduce the image size
  106. RUN apt-get autoremove -y
  107. RUN apt-get clean -y
  108. # set SHELL var to avoid /bin/sh fallback in interactive GRASS GIS sessions in docker
  109. ENV SHELL /bin/bash
  110. # Fix permissions
  111. RUN chmod -R a+rwx $DATA_DIR
  112. # create a user
  113. RUN useradd -m -U grass
  114. # declare data volume late so permissions apply
  115. VOLUME $DATA_DIR
  116. WORKDIR $DATA_DIR
  117. # Further reduce the docker image size
  118. RUN rm -rf /code/grass
  119. # switch the user
  120. USER grass
  121. CMD ["/usr/local/bin/grass", "--version"]