Dockerfile 3.3 KB

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