source: trunk/Dockerfile @ 982

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

Update version 1.8.1-dev, use demos from github and build basic services in the Dockerfile

File size: 6.1 KB
Line 
1#
2# Base: Ubuntu 18.04 with updates and external packages
3#
4FROM ubuntu:bionic-20201119 AS base
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 \
16    libpq5 \
17    libpython3.6 \
18    libxslt1.1 \
19    gdal-bin \
20    libcgal13 \
21    python3 \
22    r-base \
23    python3-pip\
24"
25RUN set -ex \
26    && apt-get update && apt-get install -y --no-install-recommends $BUILD_DEPS \
27    \
28    && add-apt-repository ppa:osgeolive/nightly \
29    && add-apt-repository ppa:ubuntugis/ppa \
30    && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9 \
31    && add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/' \
32    \
33    && apt-get install -y $RUN_DEPS \
34    \
35    && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $BUILD_DEPS \
36    && rm -rf /var/lib/apt/lists/*
37
38#
39# builder1: base image with zoo-kernel
40#
41FROM base AS builder1
42ARG DEBIAN_FRONTEND=noninteractive
43ARG BUILD_DEPS=" \
44    bison \
45    flex \
46    make \
47    autoconf \
48    gcc \
49    gettext-base \
50    \
51    libfcgi-dev \
52    libgdal-dev \
53    libjson-c-dev \
54    libssh2-1-dev \
55    libssl-dev \
56    libxml2-dev \
57    libxslt1-dev \
58    python3-dev \
59    uuid-dev \
60    r-base-dev \
61"
62WORKDIR /zoo-project
63COPY . .
64
65RUN set -ex \
66    && apt-get update && apt-get install -y --no-install-recommends $BUILD_DEPS \
67    \
68    && make -C ./thirds/cgic206 libcgic.a \
69    \
70    && cd ./zoo-project/zoo-kernel \
71    && autoconf \
72    && ./configure --with-python=/usr --with-pyvers=3.6 --with-js=/usr --with-mapserver=/usr --with-ms-version=7 --with-json=/usr --with-db-backend --prefix=/usr \
73    && make \
74    && make install \
75    \
76    # TODO: why not copied by 'make'?
77    && cp zoo_loader.cgi main.cfg /usr/lib/cgi-bin/ \
78    && cp ../zoo-services/hello-py/cgi-env/* /usr/lib/cgi-bin/ \
79    && cp ../zoo-services/hello-js/cgi-env/* /usr/lib/cgi-bin/ \
80    && cp ../zoo-api/js/* /usr/lib/cgi-bin/ \
81    && cp ../zoo-services/utils/open-api/cgi-env/* /usr/lib/cgi-bin/ \
82    && cp ../zoo-services/hello-py/cgi-env/* /usr/lib/cgi-bin/ \
83    && cp ../zoo-services/hello-js/cgi-env/* /usr/lib/cgi-bin/ \
84    && cp ../zoo-api/js/* /usr/lib/cgi-bin/ \
85    \
86    && cp oas.cfg /usr/lib/cgi-bin/ \
87    \
88    # TODO: main.cfg is not processed \
89    && prefix=/usr envsubst < main.cfg > /usr/lib/cgi-bin/main.cfg \
90    \
91    && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $BUILD_DEPS \
92    && rm -rf /var/lib/apt/lists/*
93
94#
95# Optional zoo modules build.
96#
97FROM base AS builder2
98ARG DEBIAN_FRONTEND=noninteractive
99ARG BUILD_DEPS=" \
100    bison \
101    flex \
102    make \
103    autoconf \
104    g++ \
105    gcc \
106    libc-dev \
107    libfcgi-dev \
108    libgdal-dev \
109    libxml2-dev \
110    libxslt1-dev \
111    libcgal-dev \
112"
113WORKDIR /zoo-project
114COPY ./zoo-project/zoo-services ./zoo-project/zoo-services
115
116# From zoo-kernel
117COPY --from=builder1 /usr/lib/cgi-bin/ /usr/lib/cgi-bin/
118COPY --from=builder1 /usr/lib/libzoo_service.so.1.8 /usr/lib/libzoo_service.so.1.8
119COPY --from=builder1 /usr/lib/libzoo_service.so /usr/lib/libzoo_service.so
120COPY --from=builder1 /usr/com/zoo-project/ /usr/com/zoo-project/
121COPY --from=builder1 /usr/include/zoo/ /usr/include/zoo/
122
123# Additional files from bulder2
124COPY --from=builder1 /zoo-project/zoo-project/zoo-kernel/ZOOMakefile.opts /zoo-project/zoo-project/zoo-kernel/ZOOMakefile.opts
125COPY --from=builder1 /zoo-project/zoo-project/zoo-kernel/sqlapi.h /zoo-project/zoo-project/zoo-kernel/sqlapi.h
126COPY --from=builder1 /zoo-project/zoo-project/zoo-kernel/service.h /zoo-project/zoo-project/zoo-kernel/service.h
127COPY --from=builder1 /zoo-project/zoo-project/zoo-kernel/service_internal.h /zoo-project/zoo-project/zoo-kernel/service_internal.h
128COPY --from=builder1 /zoo-project/zoo-project/zoo-kernel/version.h /zoo-project/zoo-project/zoo-kernel/version.h
129
130RUN set -ex \
131    && apt-get update && apt-get install -y --no-install-recommends $BUILD_DEPS \
132    \
133    && cd ./zoo-project/zoo-services/utils/status \
134    && make \
135    && make install \
136    \
137    && cd ../../cgal \
138    && make \
139    && cp cgi-env/* /usr/lib/cgi-bin/ \
140    \
141    && cd .. \
142    && cd ../zoo-services/ogr/base-vect-ops \
143    && make \
144    && cp cgi-env/* /usr/lib/cgi-bin/ \
145    && cd ../.. \
146    \
147    && cd ../zoo-services/gdal/ \
148    && for i in contour dem grid profile translate warp ; do cd $i ; make && cp cgi-env/* /usr/lib/cgi-bin/ ; cd .. ; done \
149    \
150    && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $BUILD_DEPS \
151    && rm -rf /var/lib/apt/lists/*
152
153#
154# Optional zoo demos download.
155#
156FROM base AS demos
157ARG DEBIAN_FRONTEND=noninteractive
158ARG BUILD_DEPS=" \
159    git \
160"
161WORKDIR /zoo-project
162
163RUN set -ex \
164    && apt-get update && apt-get install -y --no-install-recommends $BUILD_DEPS \
165    \
166    && git clone https://github.com/ZOO-Project/examples.git
167
168#
169# Runtime image with apache2.
170#
171FROM base AS runtime
172ARG DEBIAN_FRONTEND=noninteractive
173ARG RUN_DEPS=" \
174    apache2 \
175    curl \
176"
177
178# From zoo-kernel
179COPY --from=builder1 /usr/lib/cgi-bin/ /usr/lib/cgi-bin/
180COPY --from=builder1 /usr/lib/libzoo_service.so.1.8 /usr/lib/libzoo_service.so.1.8
181COPY --from=builder1 /usr/lib/libzoo_service.so /usr/lib/libzoo_service.so
182COPY --from=builder1 /usr/com/zoo-project/ /usr/com/zoo-project/
183COPY --from=builder1 /usr/include/zoo/ /usr/include/zoo/
184
185# From optional zoo modules
186COPY --from=builder2 /usr/lib/cgi-bin/ /usr/lib/cgi-bin/
187COPY --from=builder2 /usr/com/zoo-project/ /usr/com/zoo-project/
188
189# From optional zoo demos
190COPY --from=demos /zoo-project/examples/data/ /usr/com/zoo-project/
191COPY --from=demos /zoo-project/examples/ /var/www/html/
192
193
194RUN set -ex \
195    && apt-get update && apt-get install -y --no-install-recommends $RUN_DEPS \
196    \
197    && rm -rf /var/lib/apt/lists/* \
198    && pip3 install Cheetah3 redis\
199    && sed "s:AllowOverride None:AllowOverride All:g" -i /etc/apache2/apache2.conf \
200    && mkdir -p /tmp/statusInfos \
201    && chown www-data:www-data -R /tmp/statusInfos \
202    && a2enmod cgi rewrite
203
204EXPOSE 80
205CMD /usr/sbin/apache2ctl -D FOREGROUND
Note: See TracBrowser for help on using the repository browser.

Search

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