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