Spaces:
Sleeping
Sleeping
# 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"] | |