source: trunk/Dockerfile

Last change on this file was 984, checked in by djay, 4 years ago

Take into account building ZOO-Project on ubuntu focal (cf. https://trac.osgeo.org/osgeolive/ticket/2282). Add the OTB and SAGA support to the Dockerfile to make the corresponding demos using docker WPS server. Add OGC API - Processes demo to the demos list.

File size: 9.0 KB
RevLine 
[959]1#
2# Base: Ubuntu 18.04 with updates and external packages
3#
[968]4FROM ubuntu:bionic-20201119 AS base
[959]5ARG DEBIAN_FRONTEND=noninteractive
6ARG BUILD_DEPS=" \
7    dirmngr \
8    gpg-agent \
9    software-properties-common \
10"
11ARG RUN_DEPS=" \
12    libcurl3-gnutls \
13    libfcgi \
14    libmapserver-dev \
15    libmozjs185-dev \
[984]16    \
17    saga \
18    libsaga-api-7.3.0 \
19    libotb \
20    otb-bin \
21    \
[959]22    libpq5 \
[968]23    libpython3.6 \
[959]24    libxslt1.1 \
25    gdal-bin \
[982]26    libcgal13 \
[968]27    python3 \
[959]28    r-base \
[968]29    python3-pip\
[959]30"
31RUN set -ex \
32    && apt-get update && apt-get install -y --no-install-recommends $BUILD_DEPS \
33    \
34    && add-apt-repository ppa:osgeolive/nightly \
35    && add-apt-repository ppa:ubuntugis/ppa \
36    && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9 \
37    && add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/' \
38    \
39    && apt-get install -y $RUN_DEPS \
40    \
41    && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $BUILD_DEPS \
42    && rm -rf /var/lib/apt/lists/*
43
44#
45# builder1: base image with zoo-kernel
46#
47FROM base AS builder1
48ARG DEBIAN_FRONTEND=noninteractive
49ARG BUILD_DEPS=" \
50    bison \
51    flex \
52    make \
53    autoconf \
54    gcc \
55    gettext-base \
56    \
[984]57    # Comment lines bellow if nor OTB nor SAGA \
58    libotb-dev \
59    otb-qgis \
60    otb-bin-qt \
61    qttools5-dev \
62    qttools5-dev-tools \
63    qtbase5-dev \
64    libqt5opengl5-dev \
65    libtinyxml-dev \
66    libfftw3-dev \
67    cmake \
68    libsaga-dev \
69    # Comment lines before this one if nor OTB nor SAGA \
70    \
[959]71    libfcgi-dev \
72    libgdal-dev \
[984]73    libwxgtk3.0-dev \
[959]74    libjson-c-dev \
75    libssh2-1-dev \
76    libssl-dev \
77    libxml2-dev \
78    libxslt1-dev \
[968]79    python3-dev \
[959]80    uuid-dev \
81    r-base-dev \
82"
83WORKDIR /zoo-project
84COPY . .
85
86RUN set -ex \
87    && apt-get update && apt-get install -y --no-install-recommends $BUILD_DEPS \
88    \
89    && make -C ./thirds/cgic206 libcgic.a \
90    \
91    && cd ./zoo-project/zoo-kernel \
92    && autoconf \
[984]93    && ./configure --with-python=/usr --with-pyvers=3.6 --with-js=/usr --with-mapserver=/usr --with-ms-version=7 --with-json=/usr --with-r=/usr --with-db-backend --prefix=/usr --with-otb=/usr/ --with-itk=/usr --with-otb-version=6.6 --with-itk-version=4.12 --with-saga=/usr --with-saga-version=7.2 --with-wx-config=/usr/bin/wx-config \
[959]94    && make \
95    && make install \
96    \
97    # TODO: why not copied by 'make'?
98    && cp zoo_loader.cgi main.cfg /usr/lib/cgi-bin/ \
99    && cp ../zoo-services/hello-py/cgi-env/* /usr/lib/cgi-bin/ \
100    && cp ../zoo-services/hello-js/cgi-env/* /usr/lib/cgi-bin/ \
101    && cp ../zoo-api/js/* /usr/lib/cgi-bin/ \
[968]102    && cp ../zoo-services/utils/open-api/cgi-env/* /usr/lib/cgi-bin/ \
[959]103    && cp ../zoo-services/hello-py/cgi-env/* /usr/lib/cgi-bin/ \
104    && cp ../zoo-services/hello-js/cgi-env/* /usr/lib/cgi-bin/ \
[984]105    && cp ../zoo-services/hello-r/cgi-env/* /usr/lib/cgi-bin/ \
[959]106    && cp ../zoo-api/js/* /usr/lib/cgi-bin/ \
[984]107    && cp ../zoo-api/r/minimal.r /usr/lib/cgi-bin/ \
[959]108    \
109    && cp oas.cfg /usr/lib/cgi-bin/ \
110    \
111    # TODO: main.cfg is not processed \
112    && prefix=/usr envsubst < main.cfg > /usr/lib/cgi-bin/main.cfg \
113    \
[984]114    #Comment lines below from here if no OTB \
115    && mkdir otb_build \
116    && cd otb_build \
117    && cmake ../../../thirds/otb2zcfg \
118    && make \
119    && mkdir OTB \
120    && cd OTB \
121    && ITK_AUTOLOAD_PATH=/usr/lib/x86_64-linux-gnu/otb/applications/ ../otb2zcfg \
122    && mkdir /usr/lib/cgi-bin/OTB \
123    && cp *zcfg /usr/lib/cgi-bin/OTB \
124    #&& for i in *zcfg; do cp $i /usr/lib/cgi-bin/$i ; j="$(echo $i | sed "s:.zcfg::g")" ; sed "s:$j:OTB_$j:g" -i  /usr/lib/cgi-bin/OTB_$i ; done \
125    #Comment lines before this one if no OTB \
126    \
127    #Comment lines below from here if no SAGA \
128    && cd .. \
129    && make -C ../../../thirds/saga2zcfg \
130    && mkdir zcfgs \
131    && cd zcfgs \
132    && dpkg -L saga \
133    && export MODULE_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/saga/ \
134    && export SAGA_MLB=/usr/lib/x86_64-linux-gnu/saga/ \
135    && ln -s /usr/lib/x86_64-linux-gnu/saga/ /usr/lib/saga \
136    && ../../../../thirds/saga2zcfg/saga2zcfg \
137    && mkdir /usr/lib/cgi-bin/SAGA \
138    && ls \
139    && cp -r * /usr/lib/cgi-bin/SAGA \
140    #Remove OTB if not built or SAGA if no SAGA \
141    && for j in OTB SAGA ; do for i in $(find /usr/lib/cgi-bin/$j/ -name "*zcfg"); do sed "s:image/png:image/png\n     useMapserver = true\n     msClassify = true:g;s:text/xml:text/xml\n     useMapserver = true:g;s:mimeType = application/x-ogc-aaigrid:mimeType = application/x-ogc-aaigrid\n   </Supported>\n   <Supported>\n     mimeType = image/png\n     useMapserver=true:g" -i $i; done; done \
142    \
143    && cd ../.. \
144    #Comment lines before this one if nor OTB nor SAGA \
145    \
[959]146    && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $BUILD_DEPS \
147    && rm -rf /var/lib/apt/lists/*
148
149#
150# Optional zoo modules build.
151#
152FROM base AS builder2
153ARG DEBIAN_FRONTEND=noninteractive
154ARG BUILD_DEPS=" \
155    bison \
156    flex \
157    make \
158    autoconf \
159    g++ \
160    gcc \
161    libc-dev \
162    libfcgi-dev \
163    libgdal-dev \
164    libxml2-dev \
165    libxslt1-dev \
[982]166    libcgal-dev \
[959]167"
168WORKDIR /zoo-project
[982]169COPY ./zoo-project/zoo-services ./zoo-project/zoo-services
[959]170
171# From zoo-kernel
172COPY --from=builder1 /usr/lib/cgi-bin/ /usr/lib/cgi-bin/
[968]173COPY --from=builder1 /usr/lib/libzoo_service.so.1.8 /usr/lib/libzoo_service.so.1.8
[959]174COPY --from=builder1 /usr/lib/libzoo_service.so /usr/lib/libzoo_service.so
175COPY --from=builder1 /usr/com/zoo-project/ /usr/com/zoo-project/
176COPY --from=builder1 /usr/include/zoo/ /usr/include/zoo/
177
178# Additional files from bulder2
179COPY --from=builder1 /zoo-project/zoo-project/zoo-kernel/ZOOMakefile.opts /zoo-project/zoo-project/zoo-kernel/ZOOMakefile.opts
180COPY --from=builder1 /zoo-project/zoo-project/zoo-kernel/sqlapi.h /zoo-project/zoo-project/zoo-kernel/sqlapi.h
181COPY --from=builder1 /zoo-project/zoo-project/zoo-kernel/service.h /zoo-project/zoo-project/zoo-kernel/service.h
182COPY --from=builder1 /zoo-project/zoo-project/zoo-kernel/service_internal.h /zoo-project/zoo-project/zoo-kernel/service_internal.h
183COPY --from=builder1 /zoo-project/zoo-project/zoo-kernel/version.h /zoo-project/zoo-project/zoo-kernel/version.h
184
185RUN set -ex \
186    && apt-get update && apt-get install -y --no-install-recommends $BUILD_DEPS \
187    \
188    && cd ./zoo-project/zoo-services/utils/status \
189    && make \
190    && make install \
191    \
[982]192    && cd ../../cgal \
193    && make \
194    && cp cgi-env/* /usr/lib/cgi-bin/ \
195    \
196    && cd .. \
197    && cd ../zoo-services/ogr/base-vect-ops \
198    && make \
199    && cp cgi-env/* /usr/lib/cgi-bin/ \
200    && cd ../.. \
201    \
202    && cd ../zoo-services/gdal/ \
203    && for i in contour dem grid profile translate warp ; do cd $i ; make && cp cgi-env/* /usr/lib/cgi-bin/ ; cd .. ; done \
204    \
[959]205    && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $BUILD_DEPS \
206    && rm -rf /var/lib/apt/lists/*
207
208#
[982]209# Optional zoo demos download.
210#
211FROM base AS demos
212ARG DEBIAN_FRONTEND=noninteractive
213ARG BUILD_DEPS=" \
214    git \
[984]215    \
[982]216"
217WORKDIR /zoo-project
218
219RUN set -ex \
220    && apt-get update && apt-get install -y --no-install-recommends $BUILD_DEPS \
221    \
[984]222    && git clone https://github.com/ZOO-Project/examples.git \
223    && git clone https://github.com/swagger-api/swagger-ui.git
[982]224
225#
[959]226# Runtime image with apache2.
227#
228FROM base AS runtime
229ARG DEBIAN_FRONTEND=noninteractive
230ARG RUN_DEPS=" \
231    apache2 \
232    curl \
[984]233    cgi-mapserver \
234    mapserver-bin \
235    #Uncomment the line below to add vi editor \
236    #vim \
237    #Uncomment the lines below to add debuging \
238    #valgrind \
239    #gdb \
[959]240"
241
242# From zoo-kernel
243COPY --from=builder1 /usr/lib/cgi-bin/ /usr/lib/cgi-bin/
[968]244COPY --from=builder1 /usr/lib/libzoo_service.so.1.8 /usr/lib/libzoo_service.so.1.8
[959]245COPY --from=builder1 /usr/lib/libzoo_service.so /usr/lib/libzoo_service.so
246COPY --from=builder1 /usr/com/zoo-project/ /usr/com/zoo-project/
247COPY --from=builder1 /usr/include/zoo/ /usr/include/zoo/
248
249# From optional zoo modules
250COPY --from=builder2 /usr/lib/cgi-bin/ /usr/lib/cgi-bin/
251COPY --from=builder2 /usr/com/zoo-project/ /usr/com/zoo-project/
252
[982]253# From optional zoo demos
254COPY --from=demos /zoo-project/examples/data/ /usr/com/zoo-project/
255COPY --from=demos /zoo-project/examples/ /var/www/html/
[984]256COPY --from=demos /zoo-project/swagger-ui /var/www/html/swagger-ui
[982]257
258
[959]259RUN set -ex \
260    && apt-get update && apt-get install -y --no-install-recommends $RUN_DEPS \
261    \
[984]262    && sed "s=https://petstore.swagger.io/v2/swagger.json=http://localhost/ogc-api/api=g" -i /var/www/html/swagger-ui/dist/index.html \
263    && mv  /var/www/html/swagger-ui/dist  /var/www/html/swagger-ui/oapip \
264    && ln -s /tmp/ /var/www/html/temp \
265    && ln -s /usr/lib/x86_64-linux-gnu/saga/ /usr/lib/saga \
[959]266    && rm -rf /var/lib/apt/lists/* \
[968]267    && pip3 install Cheetah3 redis\
268    && sed "s:AllowOverride None:AllowOverride All:g" -i /etc/apache2/apache2.conf \
[969]269    && mkdir -p /tmp/statusInfos \
[984]270    && chown www-data:www-data -R /tmp/statusInfos /usr/com/zoo-project \
[968]271    && a2enmod cgi rewrite
[959]272
273EXPOSE 80
274CMD /usr/sbin/apache2ctl -D FOREGROUND
Note: See TracBrowser for help on using the repository browser.

Search

Context Navigation

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png