forked from OSGeo/gdal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
323 lines (287 loc) · 15.3 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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
##
# osgeo/gdal:ubuntu-full
# This file is available at the option of the licensee under:
# Public domain
# or licensed under MIT (LICENSE.TXT) Copyright 2019 Even Rouault <[email protected]>
ARG BASE_IMAGE=ubuntu:22.04
ARG TARGET_BASE_IMAGE=ubuntu:22.04
FROM $BASE_IMAGE as builder
# Derived from osgeo/proj by Howard Butler <[email protected]>
LABEL maintainer="Even Rouault <[email protected]>"
ARG TARGET_ARCH=
RUN echo ${TARGET_ARCH}
COPY ./bh-set-envvars.sh /buildscripts/bh-set-envvars.sh
RUN . /buildscripts/bh-set-envvars.sh \
&& if test "${TARGET_ARCH}" != ""; then \
rm -f /etc/apt/sources.list \
&& echo "deb [arch=amd64] http://us.archive.ubuntu.com/ubuntu/ jammy main restricted universe multiverse" >> /etc/apt/sources.list \
&& echo "deb [arch=amd64] http://us.archive.ubuntu.com/ubuntu/ jammy-updates main restricted universe multiverse" >> /etc/apt/sources.list \
&& echo "deb [arch=amd64] http://us.archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse" >> /etc/apt/sources.list \
&& echo "deb [arch=amd64] http://security.ubuntu.com/ubuntu jammy-security main restricted universe multiverse" >> /etc/apt/sources.list \
&& echo "deb [arch=${TARGET_ARCH}] http://ports.ubuntu.com/ubuntu-ports/ jammy main restricted universe multiverse" >> /etc/apt/sources.list \
&& echo "deb [arch=${TARGET_ARCH}] http://ports.ubuntu.com/ubuntu-ports/ jammy-updates main restricted universe multiverse" >> /etc/apt/sources.list \
&& echo "deb [arch=${TARGET_ARCH}] http://ports.ubuntu.com/ubuntu-ports/ jammy-security main restricted universe multiverse" >> /etc/apt/sources.list \
&& dpkg --add-architecture ${TARGET_ARCH} \
&& apt-get update -y \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y g++-11-${GCC_ARCH}-linux-gnu \
&& ln -s ${GCC_ARCH}-linux-gnu-gcc-11 /usr/bin/${GCC_ARCH}-linux-gnu-gcc \
&& ln -s ${GCC_ARCH}-linux-gnu-g++-11 /usr/bin/${GCC_ARCH}-linux-gnu-g++; \
fi
# Setup build env for PROJ
USER root
RUN . /buildscripts/bh-set-envvars.sh \
&& apt-get update -y \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --fix-missing --no-install-recommends \
build-essential ca-certificates \
git make cmake wget unzip libtool automake \
zlib1g-dev${APT_ARCH_SUFFIX} libsqlite3-dev${APT_ARCH_SUFFIX} pkg-config sqlite3 libcurl4-gnutls-dev${APT_ARCH_SUFFIX} \
libtiff5-dev${APT_ARCH_SUFFIX} \
&& rm -rf /var/lib/apt/lists/*
ARG JAVA_VERSION=11
# Setup build env for GDAL
RUN . /buildscripts/bh-set-envvars.sh \
&& apt-get update -y \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --fix-missing --no-install-recommends \
libopenjp2-7-dev${APT_ARCH_SUFFIX} libcairo2-dev${APT_ARCH_SUFFIX} \
python3-dev${APT_ARCH_SUFFIX} python3-numpy${APT_ARCH_SUFFIX} python3-setuptools${APT_ARCH_SUFFIX} \
libpng-dev${APT_ARCH_SUFFIX} libjpeg-dev${APT_ARCH_SUFFIX} libgif-dev${APT_ARCH_SUFFIX} liblzma-dev${APT_ARCH_SUFFIX} libgeos-dev${APT_ARCH_SUFFIX} \
curl libxml2-dev${APT_ARCH_SUFFIX} libexpat-dev${APT_ARCH_SUFFIX} libxerces-c-dev${APT_ARCH_SUFFIX} \
libnetcdf-dev${APT_ARCH_SUFFIX} libpoppler-dev${APT_ARCH_SUFFIX} libpoppler-private-dev${APT_ARCH_SUFFIX} \
libspatialite-dev${APT_ARCH_SUFFIX} librasterlite2-dev${APT_ARCH_SUFFIX} swig ant libhdf4-alt-dev${APT_ARCH_SUFFIX} libhdf5-serial-dev${APT_ARCH_SUFFIX} \
libfreexl-dev${APT_ARCH_SUFFIX} unixodbc-dev${APT_ARCH_SUFFIX} mdbtools-dev${APT_ARCH_SUFFIX} libwebp-dev${APT_ARCH_SUFFIX} \
liblcms2-2 libpcre3-dev${APT_ARCH_SUFFIX} libcrypto++-dev${APT_ARCH_SUFFIX} libfyba-dev${APT_ARCH_SUFFIX} \
libkml-dev${APT_ARCH_SUFFIX} libmysqlclient-dev${APT_ARCH_SUFFIX} libogdi-dev${APT_ARCH_SUFFIX} \
libcfitsio-dev${APT_ARCH_SUFFIX} openjdk-"$JAVA_VERSION"-jdk${APT_ARCH_SUFFIX} libzstd-dev${APT_ARCH_SUFFIX} \
libpq-dev${APT_ARCH_SUFFIX} libssl-dev${APT_ARCH_SUFFIX} libboost-dev${APT_ARCH_SUFFIX} \
autoconf automake bash-completion libarmadillo-dev${APT_ARCH_SUFFIX} \
libopenexr-dev${APT_ARCH_SUFFIX} libheif-dev${APT_ARCH_SUFFIX} \
libdeflate-dev${APT_ARCH_SUFFIX} libblosc-dev${APT_ARCH_SUFFIX} liblz4-dev${APT_ARCH_SUFFIX} libbz2-dev${APT_ARCH_SUFFIX} \
libbrotli-dev${APT_ARCH_SUFFIX} \
&& rm -rf /var/lib/apt/lists/*
# Build likbkea
ARG KEA_VERSION=1.4.15
RUN . /buildscripts/bh-set-envvars.sh \
&& wget -q https://github.com/ubarsc/kealib/archive/kealib-${KEA_VERSION}.zip \
&& unzip -q kealib-${KEA_VERSION}.zip \
&& rm -f kealib-${KEA_VERSION}.zip \
&& cd kealib-kealib-${KEA_VERSION} \
&& cmake . -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr -DHDF5_INCLUDE_DIR=/usr/include/hdf5/serial \
-DHDF5_LIB_PATH=/usr/lib/${GCC_ARCH}-linux-gnu/hdf5/serial -DLIBKEA_WITH_GDAL=OFF \
&& make -j$(nproc) \
&& make install DESTDIR="/build_thirdparty" \
&& make install \
&& cd .. \
&& rm -rf kealib-kealib-${KEA_VERSION} \
&& for i in /build_thirdparty/usr/lib/*; do strip -s $i 2>/dev/null || /bin/true; done \
&& for i in /build_thirdparty/usr/bin/*; do strip -s $i 2>/dev/null || /bin/true; done
# Build mongo-c-driver
ARG MONGO_C_DRIVER_VERSION=1.22.1
RUN . /buildscripts/bh-set-envvars.sh \
&& mkdir mongo-c-driver \
&& wget -q https://github.com/mongodb/mongo-c-driver/releases/download/${MONGO_C_DRIVER_VERSION}/mongo-c-driver-${MONGO_C_DRIVER_VERSION}.tar.gz -O - \
| tar xz -C mongo-c-driver --strip-components=1 \
&& cd mongo-c-driver \
&& mkdir build_cmake \
&& cd build_cmake \
&& cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DENABLE_TESTS=NO -DCMAKE_BUILD_TYPE=Release \
&& make -j$(nproc) \
&& make install DESTDIR="/build_thirdparty" \
&& make install \
&& cd ../.. \
&& rm -rf mongo-c-driver \
&& rm /build_thirdparty/usr/lib/${GCC_ARCH}-linux-gnu/*.a \
&& for i in /build_thirdparty/usr/lib/${GCC_ARCH}-linux-gnu/*; do strip -s $i 2>/dev/null || /bin/true; done \
&& for i in /build_thirdparty/usr/bin/*; do strip -s $i 2>/dev/null || /bin/true; done
# Build mongocxx
ARG MONGOCXX_VERSION=3.6.7
RUN . /buildscripts/bh-set-envvars.sh \
&& mkdir mongocxx \
&& wget -q https://github.com/mongodb/mongo-cxx-driver/archive/r${MONGOCXX_VERSION}.tar.gz -O - \
| tar xz -C mongocxx --strip-components=1 \
&& cd mongocxx \
&& mkdir build_cmake \
&& cd build_cmake \
&& cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DBSONCXX_POLY_USE_BOOST=ON -DMONGOCXX_ENABLE_SLOW_TESTS=NO -DCMAKE_BUILD_TYPE=Release -DBUILD_VERSION=${MONGOCXX_VERSION} \
&& make -j$(nproc) \
&& make install DESTDIR="/build_thirdparty" \
&& make install \
&& cd ../.. \
&& rm -rf mongocxx \
&& for i in /build_thirdparty/usr/lib/${GCC_ARCH}-linux-gnu/*; do strip -s $i 2>/dev/null || /bin/true; done \
&& for i in /build_thirdparty/usr/bin/*; do strip -s $i 2>/dev/null || /bin/true; done
# Build tiledb
ARG TILEDB_VERSION=2.11.0
RUN . /buildscripts/bh-set-envvars.sh \
&& mkdir tiledb \
&& wget -q https://github.com/TileDB-Inc/TileDB/archive/${TILEDB_VERSION}.tar.gz -O - \
| tar xz -C tiledb --strip-components=1 \
&& cd tiledb \
&& mkdir build_cmake \
&& cd build_cmake \
&& ../bootstrap --prefix=/usr --disable-werror \
&& make -j$(nproc) \
&& make install-tiledb DESTDIR="/build_thirdparty" \
&& make install-tiledb \
&& cd ../.. \
&& rm -rf tiledb \
&& for i in /build_thirdparty/usr/lib/${GCC_ARCH}-linux-gnu/*; do strip -s $i 2>/dev/null || /bin/true; done \
&& for i in /build_thirdparty/usr/bin/*; do strip -s $i 2>/dev/null || /bin/true; done
# Build openjpeg
ARG OPENJPEG_VERSION=
RUN . /buildscripts/bh-set-envvars.sh \
&& if test "${OPENJPEG_VERSION}" != ""; then ( \
wget -q https://github.com/uclouvain/openjpeg/archive/v${OPENJPEG_VERSION}.tar.gz \
&& tar xzf v${OPENJPEG_VERSION}.tar.gz \
&& rm -f v${OPENJPEG_VERSION}.tar.gz \
&& cd openjpeg-${OPENJPEG_VERSION} \
&& cmake . -DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=OFF -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
&& make -j$(nproc) \
&& make install \
&& mkdir -p /build_thirdparty/usr/lib/${GCC_ARCH}-linux-gnu \
&& rm -f /usr/lib/${GCC_ARCH}-linux-gnu/libopenjp2.so* \
&& mv /usr/lib/libopenjp2.so* /usr/lib/${GCC_ARCH}-linux-gnu \
&& cp -P /usr/lib/${GCC_ARCH}-linux-gnu/libopenjp2.so* /build_thirdparty/usr/lib/${GCC_ARCH}-linux-gnu \
&& for i in /build_thirdparty/usr/lib/${GCC_ARCH}-linux-gnu/*; do strip -s $i 2>/dev/null || /bin/true; done \
&& cd .. \
&& rm -rf openjpeg-${OPENJPEG_VERSION} \
); fi
#Build File Geodatabase
ARG WITH_FILEGDB=
RUN . /buildscripts/bh-set-envvars.sh \
&& if echo "$WITH_FILEGDB" | grep -Eiq "^(y(es)?|1|true)$" ; then ( \
wget -q https://github.com/Esri/file-geodatabase-api/raw/master/FileGDB_API_1.5.2/FileGDB_API-RHEL7-64gcc83.tar.gz \
&& tar -xzf FileGDB_API-RHEL7-64gcc83.tar.gz \
&& chown -R root:root FileGDB_API-RHEL7-64gcc83 \
&& mv FileGDB_API-RHEL7-64gcc83 /usr/local/FileGDB_API \
&& rm -rf /usr/local/FileGDB_API/lib/libstdc++* \
&& cp /usr/local/FileGDB_API/lib/* /build_thirdparty/usr/lib/x86_64-linux-gnu \
&& cp /usr/local/FileGDB_API/include/* /usr/include \
&& rm -rf FileGDB_API-RHEL7-64gcc83.tar.gz \
) ; fi
# Build libqb3
RUN . /buildscripts/bh-set-envvars.sh \
&& git clone https://github.com/lucianpls/QB3.git \
&& cd QB3/QB3lib \
&& mkdir build \
&& cd build \
&& cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release .. \
&& make -j$(nproc) \
&& make -j$(nproc) install \
&& make install DESTDIR="/build_thirdparty" \
&& cd ../../.. \
&& rm -rf QB3
ARG WITH_PDFIUM=yes
RUN if echo "$WITH_PDFIUM" | grep -Eiq "^(y(es)?|1|true)$" ; then ( \
wget -q https://github.com/rouault/pdfium_build_gdal_3_5/releases/download/v1_pdfium_5106/install-ubuntu2004-rev5106.tar.gz \
&& tar -xzf install-ubuntu2004-rev5106.tar.gz \
&& chown -R root:root install \
&& mv install/lib/* /usr/lib/ \
&& mv install/include/* /usr/include/ \
&& rm -rf install-ubuntu2004-rev5106.tar.gz install \
&& apt-get update -y \
&& apt-get install -y --fix-missing --no-install-recommends liblcms2-dev${APT_ARCH_SUFFIX} \
&& rm -rf /var/lib/apt/lists/* \
) ; fi
# Build libjxl
RUN . /buildscripts/bh-set-envvars.sh \
&& apt-get update -y \
&& apt-get install -y --fix-missing --no-install-recommends libgflags-dev${APT_ARCH_SUFFIX} \
&& git clone https://github.com/libjxl/libjxl.git --recursive \
&& cd libjxl \
&& mkdir build \
&& cd build \
&& cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DJPEGXL_ENABLE_TOOLS=OFF -DJPEGXL_ENABLE_BENCHMARK=OFF .. \
&& make -j$(nproc) \
&& make -j$(nproc) install \
&& make install DESTDIR="/build_thirdparty" \
&& rm -f /lib/${GCC_ARCH}-linux-gnu/libjxl*.a \
&& rm -f /build_thirdparty/lib/${GCC_ARCH}-linux-gnu/libjxl*.a \
&& cd ../.. \
&& rm -rf libjxl \
&& rm -rf /var/lib/apt/lists/*
# Install Arrow C++
RUN . /buildscripts/bh-set-envvars.sh \
&& apt-get update -y \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y -V ca-certificates lsb-release wget \
&& wget https://apache.jfrog.io/artifactory/arrow/$(lsb_release --id --short | tr 'A-Z' 'a-z')/apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y -V ./apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb \
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y -V libarrow-dev${APT_ARCH_SUFFIX} libparquet-dev${APT_ARCH_SUFFIX} libarrow-dataset-dev${APT_ARCH_SUFFIX} \
&& rm -rf /var/lib/apt/lists/*
RUN apt-get update -y \
&& apt-get install -y --fix-missing --no-install-recommends rsync ccache \
&& rm -rf /var/lib/apt/lists/*
ARG RSYNC_REMOTE
ARG WITH_DEBUG_SYMBOLS=no
# Refresh grids
ARG PROJ_DATUMGRID_LATEST_LAST_MODIFIED
ARG PROJ_INSTALL_PREFIX=/usr/local
COPY ./bh-proj.sh /buildscripts/bh-proj.sh
RUN . /buildscripts/bh-set-envvars.sh \
&& DESTDIR=/build_tmp_proj /buildscripts/bh-proj.sh \
&& LD_LIBRARY_PATH=/build_tmp_proj/usr/local/lib /build_tmp_proj/usr/local/bin/projsync --target-dir /tmp/proj_grids --all \
&& rm -rf /build_tmp_proj
# Build PROJ
ARG PROJ_VERSION=master
RUN . /buildscripts/bh-set-envvars.sh \
&& /buildscripts/bh-proj.sh
ARG GDAL_VERSION=master
ARG GDAL_RELEASE_DATE
ARG GDAL_BUILD_IS_RELEASE
ARG GDAL_REPOSITORY=OSGeo/gdal
# Build GDAL
COPY ./bh-gdal.sh /buildscripts/bh-gdal.sh
RUN . /buildscripts/bh-set-envvars.sh \
&& /buildscripts/bh-gdal.sh
# Build final image
FROM $TARGET_BASE_IMAGE as runner
USER root
RUN date
ARG JAVA_VERSION=11
# Update distro
RUN apt-get update -y && apt-get upgrade -y
RUN apt-get update \
# PROJ dependencies
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
libsqlite3-0 libtiff5 libcurl4 \
wget curl unzip ca-certificates \
# GDAL dependencies
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
libopenjp2-7 libcairo2 python3-numpy \
libpng16-16 libjpeg-turbo8 libgif7 liblzma5 libgeos3.10.2 libgeos-c1v5 \
libxml2 libexpat1 \
libxerces-c3.2 libnetcdf-c++4 netcdf-bin libpoppler118 libspatialite7 librasterlite2-1 gpsbabel \
libhdf4-0-alt libhdf5-103 libhdf5-cpp-103 poppler-utils libfreexl1 unixodbc mdbtools libwebp7 \
liblcms2-2 libpcre3 libcrypto++8 libfyba0 \
libkmlbase1 libkmlconvenience1 libkmldom1 libkmlengine1 libkmlregionator1 libkmlxsd1 \
libmysqlclient21 libogdi4.1 libcfitsio9 openjdk-"$JAVA_VERSION"-jre \
libzstd1 bash bash-completion libpq5 libssl3 \
libarmadillo10 libpython3.10 libopenexr25 libheif1 \
libdeflate0 libblosc1 liblz4-1 \
libbrotli1 \
python-is-python3 \
# Workaround bug in ogdi packaging
&& ln -s /usr/lib/ogdi/libvrf.so /usr/lib \
# Install Arrow C++
&& DEBIAN_FRONTEND=noninteractive apt-get install -y -V ca-certificates lsb-release wget \
&& wget https://apache.jfrog.io/artifactory/arrow/$(lsb_release --id --short | tr 'A-Z' 'a-z')/apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y -V ./apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb \
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y -V libarrow900 libparquet900 libarrow-dataset900 \
&& rm -rf /var/lib/apt/lists/*
# Attempt to order layers starting with less frequently varying ones
COPY --from=builder /build_thirdparty/usr/ /usr/
ARG PROJ_INSTALL_PREFIX=/usr/local
COPY --from=builder /tmp/proj_grids/* ${PROJ_INSTALL_PREFIX}/share/proj/
COPY --from=builder /build${PROJ_INSTALL_PREFIX}/share/proj/ ${PROJ_INSTALL_PREFIX}/share/proj/
COPY --from=builder /build${PROJ_INSTALL_PREFIX}/include/ ${PROJ_INSTALL_PREFIX}/include/
COPY --from=builder /build${PROJ_INSTALL_PREFIX}/bin/ ${PROJ_INSTALL_PREFIX}/bin/
COPY --from=builder /build${PROJ_INSTALL_PREFIX}/lib/ ${PROJ_INSTALL_PREFIX}/lib/
COPY --from=builder /build/usr/share/java /usr/share/java
COPY --from=builder /build/usr/share/gdal/ /usr/share/gdal/
COPY --from=builder /build/usr/include/ /usr/include/
COPY --from=builder /build_gdal_python/usr/ /usr/
COPY --from=builder /build_gdal_version_changing/usr/ /usr/
RUN ldconfig