-
Notifications
You must be signed in to change notification settings - Fork 17
/
Dockerfile.wheels
190 lines (171 loc) · 6.24 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
# 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 postgresql-devel
# Install openssl
RUN mkdir -p /src \
&& cd /src \
&& curl -f -L -O https://www.openssl.org/source/openssl-1.0.2o.tar.gz \
&& echo "ec3f5c9714ba0fd45cb4e087301eb1336c317e0d20b575a125050470e8089e4d openssl-1.0.2o.tar.gz" > checksum \
&& sha256sum -c checksum \
&& tar zxf openssl-1.0.2o.tar.gz \
&& cd /src/openssl-1.0.2o \
&& ./config no-shared no-ssl2 no-async -fPIC -O2 \
&& make -j 4 \
&& make install \
&& rm -rf /src
# Install curl
RUN mkdir -p /src \
&& cd /src \
&& curl -f -L -O http://curl.askapache.com/download/curl-7.73.0.tar.bz2 \
&& tar jxf curl-7.73.0.tar.bz2 \
&& cd /src/curl-7.73.0 \
&& LIBS=-ldl CFLAGS="-O2 -Wl,-S" ./configure --with-ssl=/usr/local/ssl \
&& make -j 4 \
&& make install \
&& rm -rf /src
# Install geos
RUN mkdir -p /src \
&& cd /src \
&& curl -f -L -O http://download.osgeo.org/geos/geos-3.9.0.tar.bz2 \
&& tar jxf geos-3.9.0.tar.bz2 \
&& cd /src/geos-3.9.0 \
&& CFLAGS="-O2 -Wl,-S" CXXFLAGS="-O2 -Wl,-S" ./configure \
&& make -j 4 \
&& 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 4 \
&& make install \
&& rm -rf /src
# proj4
RUN mkdir -p /src \
&& cd /src \
&& curl -f -L -O http://download.osgeo.org/proj/proj-4.9.3.tar.gz \
&& tar xzf proj-4.9.3.tar.gz \
&& cd /src/proj-4.9.3 \
&& ./configure CFLAGS="-O2 -Wl,-S" \
&& make -j 4 \
&& make install \
&& rm -rf /src
# cmake
RUN cd /usr/local/src \
&& curl -f -L -O http://www.cmake.org/files/v3.13/cmake-3.13.5.tar.gz \
&& tar xzf cmake-3.13.5.tar.gz \
&& cd cmake-3.13.5 \
&& ./bootstrap --prefix=/usr/local/cmake \
&& make -j 4; make install
# openjpeg
RUN mkdir -p /src \
&& cd /src \
&& curl -f -L -O https://github.com/uclouvain/openjpeg/archive/v2.4.0.tar.gz \
&& tar xzf v2.4.0.tar.gz \
&& cd /src/openjpeg-2.4.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 4 install \
&& make clean \
&& rm -rf /src
# hdf5
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 4 \
&& 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 4 \
&& make install
## expat
RUN cd /usr/local/src \
&& curl -f -L -O https://github.com/libexpat/libexpat/releases/download/R_2_2_10/expat-2.2.10.tar.bz2 \
&& tar xjf expat-2.2.10.tar.bz2 \
&& cd expat-2.2.10 \
&& CFLAGS="-O2 -Wl,-S" ./configure --prefix=/usr/local \
&& make -j 4 \
&& make install
## webp
RUN cd /usr/local/src \
&& curl -f -L -O https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.2.0.tar.gz \
&& tar xzf libwebp-1.2.0.tar.gz \
&& cd libwebp-1.2.0 \
&& CFLAGS="-O2 -Wl,-S" ./configure --prefix=/usr/local \
&& make -j 4 \
&& make install
# gdal
RUN mkdir -p /src \
&& cd /src \
&& curl -f -L -O http://download.osgeo.org/gdal/2.4.4/gdal-2.4.4.tar.gz \
&& tar xzf gdal-2.4.4.tar.gz \
&& cd /src/gdal-2.4.4 \
&& 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-pg \
--with-gif \
--with-png \
--with-webp \
--with-geotiff=internal \
--with-sqlite3=/usr \
--with-pcraster=internal \
--with-pcidsk=internal \
--with-bsb \
--with-grib \
--with-pam \
--with-geos=/usr/local/bin/geos-config \
--with-static-proj4=/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/netcdf \
--with-openjpeg \
--with-jasper=/usr/local \
--with-hdf5=/usr/local \
--without-python \
--without-hdf4 \
&& make -j 12 \
&& make install
# Bake dev requirements into the Docker image for faster builds
ADD requirements.txt /tmp/requirements.txt
RUN for PYBIN in /opt/python/*/bin; do \
$PYBIN/pip install -U pip || true; \
$PYBIN/pip install -r /tmp/requirements.txt || true; \
done
# Replace SWIG's setup.py with this modified one, which gets numpy in
# there as a dependency.
ADD setup.py /src/gdal-2.4.4/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-2.4.4/swig/python/osgeo/__init__.py
WORKDIR /io
CMD ["/io/build-linux-wheels.sh"]