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. 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. sqlite3 \
  58. subversion \
  59. unixodbc-dev \
  60. zlib1g-dev \
  61. && apt-get autoremove \
  62. && apt-get clean && \
  63. mkdir -p $DATA_DIR
  64. RUN echo LANG="en_US.UTF-8" > /etc/default/locale
  65. ENV LANG C.UTF-8
  66. ENV LC_ALL C.UTF-8
  67. RUN mkdir /code
  68. RUN mkdir /code/grass
  69. # add repository files to the image
  70. COPY . /code/grass
  71. WORKDIR /code/grass
  72. # Set gcc/g++ environmental variables for GRASS GIS compilation, without debug symbols
  73. ENV MYCFLAGS "-O2 -std=gnu99 -m64"
  74. ENV MYLDFLAGS "-s"
  75. # CXX stuff:
  76. ENV LD_LIBRARY_PATH "/usr/local/lib"
  77. ENV LDFLAGS "$MYLDFLAGS"
  78. ENV CFLAGS "$MYCFLAGS"
  79. ENV CXXFLAGS "$MYCXXFLAGS"
  80. # Configure, compile and install GRASS GIS
  81. ENV NUMTHREADS=2
  82. RUN ./configure \
  83. --enable-largefile \
  84. --with-cxx \
  85. --with-nls \
  86. --with-readline \
  87. --with-sqlite \
  88. --with-bzlib \
  89. --with-zstd \
  90. --with-cairo --with-cairo-ldflags=-lfontconfig \
  91. --with-freetype --with-freetype-includes="/usr/include/freetype2/" \
  92. --with-fftw \
  93. --with-netcdf \
  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"]