[959] | 1 | # |
---|
| 2 | # Base: Ubuntu 18.04 with updates and external packages |
---|
| 3 | # |
---|
| 4 | FROM ubuntu:bionic-20200713 AS base |
---|
| 5 | ARG DEBIAN_FRONTEND=noninteractive |
---|
| 6 | ARG BUILD_DEPS=" \ |
---|
| 7 | dirmngr \ |
---|
| 8 | gpg-agent \ |
---|
| 9 | software-properties-common \ |
---|
| 10 | " |
---|
| 11 | ARG RUN_DEPS=" \ |
---|
| 12 | libcurl3-gnutls \ |
---|
| 13 | libfcgi \ |
---|
| 14 | libmapserver-dev \ |
---|
| 15 | libmozjs185-dev \ |
---|
| 16 | libpq5 \ |
---|
| 17 | libpython2.7 \ |
---|
| 18 | libxslt1.1 \ |
---|
| 19 | gdal-bin \ |
---|
| 20 | python \ |
---|
| 21 | r-base \ |
---|
| 22 | " |
---|
| 23 | RUN set -ex \ |
---|
| 24 | && apt-get update && apt-get install -y --no-install-recommends $BUILD_DEPS \ |
---|
| 25 | \ |
---|
| 26 | && add-apt-repository ppa:osgeolive/nightly \ |
---|
| 27 | && add-apt-repository ppa:ubuntugis/ppa \ |
---|
| 28 | && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9 \ |
---|
| 29 | && add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/' \ |
---|
| 30 | \ |
---|
| 31 | && apt-get install -y $RUN_DEPS \ |
---|
| 32 | \ |
---|
| 33 | && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $BUILD_DEPS \ |
---|
| 34 | && rm -rf /var/lib/apt/lists/* |
---|
| 35 | |
---|
| 36 | # |
---|
| 37 | # builder1: base image with zoo-kernel |
---|
| 38 | # |
---|
| 39 | FROM base AS builder1 |
---|
| 40 | ARG DEBIAN_FRONTEND=noninteractive |
---|
| 41 | ARG BUILD_DEPS=" \ |
---|
| 42 | bison \ |
---|
| 43 | flex \ |
---|
| 44 | make \ |
---|
| 45 | autoconf \ |
---|
| 46 | gcc \ |
---|
| 47 | gettext-base \ |
---|
| 48 | \ |
---|
| 49 | libfcgi-dev \ |
---|
| 50 | libgdal-dev \ |
---|
| 51 | libjson-c-dev \ |
---|
| 52 | libssh2-1-dev \ |
---|
| 53 | libssl-dev \ |
---|
| 54 | libxml2-dev \ |
---|
| 55 | libxslt1-dev \ |
---|
| 56 | python-dev \ |
---|
| 57 | uuid-dev \ |
---|
| 58 | r-base-dev \ |
---|
| 59 | " |
---|
| 60 | WORKDIR /zoo-project |
---|
| 61 | COPY . . |
---|
| 62 | |
---|
| 63 | RUN set -ex \ |
---|
| 64 | && apt-get update && apt-get install -y --no-install-recommends $BUILD_DEPS \ |
---|
| 65 | \ |
---|
| 66 | && make -C ./thirds/cgic206 libcgic.a \ |
---|
| 67 | \ |
---|
| 68 | && cd ./zoo-project/zoo-kernel \ |
---|
| 69 | && autoconf \ |
---|
| 70 | && ./configure --with-python --with-js=/usr --with-mapserver=/usr --with-ms-version=7 --with-json=/usr --with-db-backend --prefix=/usr \ |
---|
| 71 | && make \ |
---|
| 72 | && make install \ |
---|
| 73 | \ |
---|
| 74 | # TODO: why not copied by 'make'? |
---|
| 75 | && cp zoo_loader.cgi main.cfg /usr/lib/cgi-bin/ \ |
---|
| 76 | && cp ../zoo-services/hello-py/cgi-env/* /usr/lib/cgi-bin/ \ |
---|
| 77 | && cp ../zoo-services/hello-js/cgi-env/* /usr/lib/cgi-bin/ \ |
---|
| 78 | && cp ../zoo-api/js/* /usr/lib/cgi-bin/ \ |
---|
| 79 | && cp ../zoo-services/hello-py/cgi-env/* /usr/lib/cgi-bin/ \ |
---|
| 80 | && cp ../zoo-services/hello-js/cgi-env/* /usr/lib/cgi-bin/ \ |
---|
| 81 | && cp ../zoo-api/js/* /usr/lib/cgi-bin/ \ |
---|
| 82 | \ |
---|
| 83 | && cp oas.cfg /usr/lib/cgi-bin/ \ |
---|
| 84 | \ |
---|
| 85 | # TODO: main.cfg is not processed \ |
---|
| 86 | && prefix=/usr envsubst < main.cfg > /usr/lib/cgi-bin/main.cfg \ |
---|
| 87 | \ |
---|
| 88 | && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $BUILD_DEPS \ |
---|
| 89 | && rm -rf /var/lib/apt/lists/* |
---|
| 90 | |
---|
| 91 | # |
---|
| 92 | # Optional zoo modules build. |
---|
| 93 | # |
---|
| 94 | FROM base AS builder2 |
---|
| 95 | ARG DEBIAN_FRONTEND=noninteractive |
---|
| 96 | ARG BUILD_DEPS=" \ |
---|
| 97 | bison \ |
---|
| 98 | flex \ |
---|
| 99 | make \ |
---|
| 100 | autoconf \ |
---|
| 101 | g++ \ |
---|
| 102 | gcc \ |
---|
| 103 | libc-dev \ |
---|
| 104 | libfcgi-dev \ |
---|
| 105 | libgdal-dev \ |
---|
| 106 | libxml2-dev \ |
---|
| 107 | libxslt1-dev \ |
---|
| 108 | " |
---|
| 109 | WORKDIR /zoo-project |
---|
| 110 | COPY ./zoo-project/zoo-services/utils/status ./zoo-project/zoo-services/utils/status |
---|
| 111 | |
---|
| 112 | # From zoo-kernel |
---|
| 113 | COPY --from=builder1 /usr/lib/cgi-bin/ /usr/lib/cgi-bin/ |
---|
| 114 | COPY --from=builder1 /usr/lib/libzoo_service.so.1.5 /usr/lib/libzoo_service.so.1.5 |
---|
| 115 | COPY --from=builder1 /usr/lib/libzoo_service.so /usr/lib/libzoo_service.so |
---|
| 116 | COPY --from=builder1 /usr/com/zoo-project/ /usr/com/zoo-project/ |
---|
| 117 | COPY --from=builder1 /usr/include/zoo/ /usr/include/zoo/ |
---|
| 118 | |
---|
| 119 | # Additional files from bulder2 |
---|
| 120 | COPY --from=builder1 /zoo-project/zoo-project/zoo-kernel/ZOOMakefile.opts /zoo-project/zoo-project/zoo-kernel/ZOOMakefile.opts |
---|
| 121 | COPY --from=builder1 /zoo-project/zoo-project/zoo-kernel/sqlapi.h /zoo-project/zoo-project/zoo-kernel/sqlapi.h |
---|
| 122 | COPY --from=builder1 /zoo-project/zoo-project/zoo-kernel/service.h /zoo-project/zoo-project/zoo-kernel/service.h |
---|
| 123 | COPY --from=builder1 /zoo-project/zoo-project/zoo-kernel/service_internal.h /zoo-project/zoo-project/zoo-kernel/service_internal.h |
---|
| 124 | COPY --from=builder1 /zoo-project/zoo-project/zoo-kernel/version.h /zoo-project/zoo-project/zoo-kernel/version.h |
---|
| 125 | |
---|
| 126 | RUN set -ex \ |
---|
| 127 | && apt-get update && apt-get install -y --no-install-recommends $BUILD_DEPS \ |
---|
| 128 | \ |
---|
| 129 | && cd ./zoo-project/zoo-services/utils/status \ |
---|
| 130 | && make \ |
---|
| 131 | && make install \ |
---|
| 132 | \ |
---|
| 133 | && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $BUILD_DEPS \ |
---|
| 134 | && rm -rf /var/lib/apt/lists/* |
---|
| 135 | |
---|
| 136 | # |
---|
| 137 | # Runtime image with apache2. |
---|
| 138 | # |
---|
| 139 | FROM base AS runtime |
---|
| 140 | ARG DEBIAN_FRONTEND=noninteractive |
---|
| 141 | ARG RUN_DEPS=" \ |
---|
| 142 | apache2 \ |
---|
| 143 | curl \ |
---|
| 144 | " |
---|
| 145 | |
---|
| 146 | # From zoo-kernel |
---|
| 147 | COPY --from=builder1 /usr/lib/cgi-bin/ /usr/lib/cgi-bin/ |
---|
| 148 | COPY --from=builder1 /usr/lib/libzoo_service.so.1.5 /usr/lib/libzoo_service.so.1.5 |
---|
| 149 | COPY --from=builder1 /usr/lib/libzoo_service.so /usr/lib/libzoo_service.so |
---|
| 150 | COPY --from=builder1 /usr/com/zoo-project/ /usr/com/zoo-project/ |
---|
| 151 | COPY --from=builder1 /usr/include/zoo/ /usr/include/zoo/ |
---|
| 152 | |
---|
| 153 | # From optional zoo modules |
---|
| 154 | COPY --from=builder2 /usr/lib/cgi-bin/ /usr/lib/cgi-bin/ |
---|
| 155 | COPY --from=builder2 /usr/com/zoo-project/ /usr/com/zoo-project/ |
---|
| 156 | |
---|
| 157 | RUN set -ex \ |
---|
| 158 | && apt-get update && apt-get install -y --no-install-recommends $RUN_DEPS \ |
---|
| 159 | \ |
---|
| 160 | && rm -rf /var/lib/apt/lists/* \ |
---|
| 161 | && a2enmod cgi |
---|
| 162 | |
---|
| 163 | EXPOSE 80 |
---|
| 164 | CMD /usr/sbin/apache2ctl -D FOREGROUND |
---|