forked from youngpm/gdalmanylinux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.wheels
254 lines (227 loc) · 8.44 KB
/
Dockerfile.wheels
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
# An image for building manylinux1 wheels equivalent to those that
# https://github.com/sgillies/frs-wheel-builds makes for macosx.
#
# TODO: Figure out how to make the builds for osx!
#
# Note well: a very limited set of format drivers are included in these
# wheels. See the GDAL configuration below for details.
FROM quay.io/pypa/manylinux1_x86_64
RUN sed -i 's/enabled=1/enabled=0/' /etc/yum/pluginconf.d/fastestmirror.conf \
&& sed -i 's/mirrorlist/#mirrorlist/' /etc/yum.repos.d/CentOS-Base.repo \
&& sed -i 's|#baseurl=http://mirror.centos.org/centos/$releasever|baseurl=http://vault.centos.org/5.11|' /etc/yum.repos.d/CentOS-Base.repo
RUN yum update -y && yum install -y curl-devel json-c-devel zlib-devel libtiff-devel krb5-devel pam-devel cyrus-sasl-devel libxml2-devel openssl-devel
# Install perl 5.10 for openssl
RUN mkdir -p /src \
&& cd /src \
&& curl -f -L -O https://cpan.metacpan.org/authors/id/D/DA/DAPM/perl-5.10.1.tar.gz \
&& tar zxf perl-5.10.1.tar.gz \
&& cd /src/perl-5.10.1 \
&& sh ./Configure -de \
&& make -j 8 \
&& make install \
&& rm -rf /src
# Install openssl 1.1.1
RUN mkdir -p /src \
&& cd /src \
&& curl -f -L -O https://github.com/openssl/openssl/archive/OpenSSL_1_1_1r.tar.gz \
&& tar zxf OpenSSL_1_1_1r.tar.gz \
&& cd /src/openssl-OpenSSL_1_1_1r \
&& ./config no-shared -fPIC -O2 \
&& make -j 8 \
&& make install \
&& rm -rf /src
# Install curl
RUN mkdir -p /src \
&& cd /src \
&& curl -f -L -O http://curl.askapache.com/download/curl-7.59.0.tar.bz2 \
&& tar jxf curl-7.59.0.tar.bz2 \
&& cd /src/curl-7.59.0 \
&& LIBS=-ldl CFLAGS="-O2 -Wl,-S" CPPFLAGS="-I/usr/local/include" LDFLAGS="-L/usr/local/lib64" ./configure \
&& make -j 8 \
&& make install \
&& rm -rf /src
# Install geos
RUN mkdir -p /src \
&& cd /src \
&& curl -f -L -O http://download.osgeo.org/geos/geos-3.8.1.tar.bz2 \
&& tar jxf geos-3.8.1.tar.bz2 \
&& cd /src/geos-3.8.1 \
&& CFLAGS="-O2 -Wl,-S" CXXFLAGS="-O2 -Wl,-S" ./configure \
&& make -j 8 \
&& make install \
&& rm -rf /src
# Install jasper
RUN mkdir -p /src \
&& cd /src \
&& curl -f -L -O http://download.osgeo.org/gdal/jasper-1.900.1.uuid.tar.gz \
&& tar xzf jasper-1.900.1.uuid.tar.gz \
&& cd /src/jasper-1.900.1.uuid \
&& ./configure --disable-debug --enable-shared \
&& make -j 8 \
&& make install \
&& rm -rf /src
# proj6
RUN mkdir -p /src \
&& cd /src \
&& curl -f -L -O http://download.osgeo.org/proj/proj-6.3.1.tar.gz \
&& tar xzf proj-6.3.1.tar.gz \
&& cd /src/proj-6.3.1 \
&& ./configure CFLAGS="-O2 -Wl,-S" \
&& make -j 8 \
&& make install \
&& rm -rf /src
# cmake
RUN cd /usr/local/src \
&& curl -f -L -O http://www.cmake.org/files/v3.11/cmake-3.11.1.tar.gz \
&& tar xzf cmake-3.11.1.tar.gz \
&& cd cmake-3.11.1 \
&& ./bootstrap --prefix=/usr/local/cmake -- -DCMAKE_USE_OPENSSL=OFF\
&& make -j 8; make install
# openjpeg
RUN mkdir -p /src \
&& cd /src \
&& curl -f -L -O https://github.com/uclouvain/openjpeg/archive/v2.3.0.tar.gz \
&& tar xzf v2.3.0.tar.gz \
&& cd /src/openjpeg-2.3.0 \
&& mkdir -p build \
&& cd build \
&& /usr/local/cmake/bin/cmake .. -DBUILD_THIRDPARTY:BOOL=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local \
&& make -j 8 install \
&& make clean \
&& rm -rf /src
# hdf
RUN cd /usr/local/src \
&& curl -f -L -O https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.12/hdf5-1.12.0/src/hdf5-1.12.0.tar.gz \
&& tar xzf hdf5-1.12.0.tar.gz \
&& cd hdf5-1.12.0 \
&& ./configure --prefix=/usr/local --enable-shared --enable-build-mode=production CFLAGS="-O2 -Wl,-S" \
&& make -j 8 \
&& make install
## netcdf
RUN cd /usr/local/src \
&& curl -f -L -O ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-4.6.1.tar.gz \
&& tar xzf netcdf-4.6.1.tar.gz \
&& cd netcdf-4.6.1 \
&& CFLAGS="-I/usr/local/include -O2 -Wl,-S" CXXFLAGS="-I/usr/local/include -O2 -Wl,-S" LDFLAGS="-L/usr/local/lib" ./configure \
&& make -j 8 \
&& make install
## expat
RUN cd /usr/local/src \
&& curl -f -L -O https://github.com/libexpat/libexpat/releases/download/R_2_2_5/expat-2.2.5.tar.bz2 \
&& tar xjf expat-2.2.5.tar.bz2 \
&& cd expat-2.2.5 \
&& CFLAGS="-O2 -Wl,-S" ./configure --prefix=/usr/local \
&& make -j 8 \
&& make install
## webp
RUN cd /usr/local/src \
&& curl -f -L -O https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-0.6.1.tar.gz \
&& tar xzf libwebp-0.6.1.tar.gz \
&& cd libwebp-0.6.1 \
&& CFLAGS="-O2 -Wl,-S" ./configure --prefix=/usr/local \
&& make -j 8 \
&& make install
## libpq
ADD build_pg.sh /tmp/build_pg.sh
RUN cd /usr/local/src \
&& bash -x /tmp/build_pg.sh
## libspatialite need some dependencies....
# freexl
RUN cd /usr/local/src \
&& curl -f -L -O https://www.gaia-gis.it/gaia-sins/freexl-sources/freexl-1.0.6.tar.gz \
&& tar xzf freexl-1.0.6.tar.gz \
&& cd freexl-1.0.6 \
&& CFLAGS="-O2 -Wl,-S" ./configure --prefix=/usr/local \
&& make -j 8 \
&& make install
# librttopo
RUN cd /usr/local/src \
&& curl -f -L -O https://git.osgeo.org/gitea/rttopo/librttopo/archive/librttopo-1.1.0.tar.gz \
&& tar xzf librttopo-1.1.0.tar.gz \
&& cd librttopo \
&& ./autogen.sh \
&& CFLAGS="-O2 -Wl,-S" ./configure --prefix=/usr/local \
&& make -j 8 \
&& make install
# minizip 1.1
RUN cd /usr/local/src \
&& curl -f -L -O https://github.com/F2I-Consulting/Minizip/archive/refs/tags/v1.1_cmake0.1.tar.gz \
&& tar xzf v1.1_cmake0.1.tar.gz \
&& cd Minizip-1.1_cmake0.1 \
&& mkdir -p build \
&& cd build \
&& /usr/local/cmake/bin/cmake .. -DCMAKE_C_FLAGS="-DNOCRYPT" -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_INSTALL_INCLUDEDIR=/usr/local/include/minizip \
&& make -j8 \
&& make install
# libspatialite 5 itself
RUN cd /usr/local/src \
&& curl -f -L -O https://www.gaia-gis.it/gaia-sins/libspatialite-5.0.1.tar.gz \
&& tar xzf libspatialite-5.0.1.tar.gz \
&& cd libspatialite-5.0.1 \
&& CFLAGS="-std=c99" ./configure --prefix=/usr/local \
&& make -j 8 \
&& make install
# gdal
RUN mkdir -p /src \
&& cd /src \
&& curl -f -L -O https://github.com/OSGeo/gdal/releases/download/v3.5.3/gdal-3.5.3.tar.gz \
&& tar xzf gdal-3.5.3.tar.gz \
&& cd /src/gdal-3.5.3 \
&& LDFLAGS="-L/usr/local/lib64" CFLAGS="-O2 -Wl,-S" CXXFLAGS="-O2 -Wl,-S" ./configure \
--with-threads \
--disable-debug \
--disable-static \
--without-grass \
--without-libgrass \
--without-jpeg12 \
--with-libtiff \
--with-jpeg \
--with-gif \
--with-png \
--with-webp \
--with-geotiff=internal \
--with-sqlite3=/usr/local \
--with-pcraster=internal \
--with-pcidsk=internal \
--with-bsb \
--with-grib \
--with-pam \
--with-geos=/usr/local/bin/geos-config \
--with-proj=/usr/local \
--with-expat=/usr/local \
--with-libjson-c \
--with-libiconv-prefix=/usr \
--with-libz=/usr \
--with-curl=/usr/local/bin/curl-config \
--with-netcdf=/usr/local \
--with-openjpeg \
--with-jasper=/usr/local \
--with-pg \
--with-spatialite \
--without-python \
--without-hdf5 \
--without-hdf4 \
&& make -j 8 \
&& make install
# Bake dev requirements into the Docker image for faster builds
# XXX setuptools 57.5.0 installed to avoid https://github.com/nextgis/pygdal/issues/67
# we need to update setup.py instead
ADD requirements.txt /tmp/requirements.txt
RUN for PYBIN in /opt/python/*/bin; do \
if [[ $PYBIN == *"26"* ]]; then continue; fi; \
if [[ $PYBIN == *"27"* ]]; then continue; fi; \
if [[ $PYBIN == *"33"* ]]; then continue; fi; \
if [[ $PYBIN == *"35"* ]]; then continue; fi; \
$PYBIN/pip install -U pip ; \
$PYBIN/pip install --upgrade --no-cache-dir setuptools==57.5.0 ; \
$PYBIN/pip install -r /tmp/requirements.txt ; \
done
# Replace SWIG's setup.py with this modified one, which gets numpy in
# there as a dependency.
ADD setup.py /src/gdal-3.5.3/swig/python/setup.py
# Replace the osgeo module __init__.py with this modified one, which
# sets the GDAL_DATA and PROJ_LIB variables on import to where they've
# been copied to.
ADD gdalinit.py /src/gdal-3.5.3/swig/python/osgeo/__init__.py
WORKDIR /io
CMD ["/io/build-linux-wheels.sh"]