11FROM lambci/lambda:build-python3.6
22
3+ # Build GIS libs for AWS serverless solutions.
4+ # See also the source builds for Debian packaging:
5+ # - https://salsa.debian.org/debian-gis-team
6+ # - https://packages.ubuntu.com/source/eoan/gdal
7+
38ENV \
49 LANG=en_US.UTF-8 \
510 LC_ALL=en_US.UTF-8
@@ -12,21 +17,22 @@ RUN yum install -y automake16 libpng-devel nasm
1217ARG prefix=/var/task
1318ENV PREFIX=${prefix}
1419
15- # versions of packages
16- ENV \
17- PKGCONFIG_VERSION=0.29.2 \
18- PROJ_VERSION=5.2.0 \
19- GEOS_VERSION=3.7.1 \
20- LIBPNG_VERSION=1.6.36 \
21- OPENJPEG_VERSION=2.3. 1 \
22- LIBJPEG_TURBO_VERSION=2.0.1 \
23- WEBP_VERSION=1.0.2 \
24- ZSTD_VERSION=1.3.8 \
25- CURL_VERSION=7.59.0 \
26- NGHTTP2_VERSION=1.35.1 \
27- GDAL_VERSION=2.4.2
20+ ENV CPPFLAGS= "-I${PREFIX}/include $CPPFLAGS"
21+ ENV LDFLAGS= "-L${PREFIX}/lib $LDFLAGS"
22+
23+ # pkg-config
24+ ENV PKGCONFIG_VERSION=0.29.2
25+ RUN mkdir /tmp/pkg-config \
26+ && curl -sfL https://pkg-config.freedesktop.org/releases/pkg-config-${PKGCONFIG_VERSION}.tar.gz | tar zxf - -C /tmp/pkg-config --strip-components= 1 \
27+ && cd /tmp/pkg-config \
28+ && CFLAGS= "-O2 -Wl,-S" ./configure --prefix=$PREFIX \
29+ && make -j $(nproc) --silent && make install && make clean \
30+ && rm -rf /tmp/pkg-config
31+
32+ ENV PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig/
2833
2934# nghttp2
35+ ENV NGHTTP2_VERSION=1.35.1
3036RUN mkdir /tmp/nghttp2 \
3137 && curl -sfL https://github.com/nghttp2/nghttp2/releases/download/v${NGHTTP2_VERSION}/nghttp2-${NGHTTP2_VERSION}.tar.gz | tar zxf - -C /tmp/nghttp2 --strip-components=1 \
3238 && cd /tmp/nghttp2 \
@@ -35,55 +41,64 @@ RUN mkdir /tmp/nghttp2 \
3541 && rm -rf /tmp/nghttp2
3642
3743# libcurl
44+ ENV CURL_VERSION=7.59.0
3845RUN mkdir /tmp/libcurl \
3946 && curl -sfL https://curl.haxx.se/download/curl-${CURL_VERSION}.tar.gz | tar zxf - -C /tmp/libcurl --strip-components=1 \
4047 && cd /tmp/libcurl \
4148 && ./configure --disable-manual --disable-cookies --with-nghttp2=$PREFIX --prefix=$PREFIX \
4249 && make -j $(nproc) --silent && make install && make clean \
4350 && rm -rf /tmp/libcurl
4451
45- # pkg-config
46- RUN mkdir /tmp/pkg-config \
47- && curl -sfL https://pkg-config.freedesktop.org/releases/pkg-config-$PKGCONFIG_VERSION.tar.gz | tar zxf - -C /tmp/pkg-config --strip-components=1 \
48- && cd /tmp/pkg-config \
49- && CFLAGS="-O2 -Wl,-S" ./configure --prefix=$PREFIX \
50- && make -j $(nproc) --silent && make install && make clean \
51- && rm -rf /tmp/pkg-config
52-
53- # proj
54- RUN mkdir /tmp/proj \
55- && curl -sfL http://download.osgeo.org/proj/proj-$PROJ_VERSION.tar.gz | tar zxf - -C /tmp/proj --strip-components=1 \
56- && cd /tmp/proj \
57- && CFLAGS="-O2 -Wl,-S" CXXFLAGS="-O2 -Wl,-S" ./configure --prefix=$PREFIX \
58- && make && make install && make clean \
59- && rm -rf /tmp/proj
52+ # sqlite3
53+ ENV SQLITE3_VERSION=3.29.0
54+ RUN mkdir /tmp/sqlite3 \
55+ && curl -sfL https://www.sqlite.org/2019/sqlite-autoconf-3290000.tar.gz | tar zxf - -C /tmp/sqlite3 --strip-components=1 \
56+ && cd /tmp/sqlite3 \
57+ && ./configure --prefix=$PREFIX \
58+ && make -j $(nproc) --silent && make install && make clean \
59+ && rm -rf /tmp/sqlite3
6060
6161# geos
62+ ENV GEOS_VERSION=3.7.1
6263RUN mkdir /tmp/geos \
63- && curl -sfL http://download.osgeo.org/geos/geos-$GEOS_VERSION.tar.bz2 | tar jxf - -C /tmp/geos --strip-components=1 \
64+ && curl -sfL http://download.osgeo.org/geos/geos-${ GEOS_VERSION} .tar.bz2 | tar jxf - -C /tmp/geos --strip-components=1 \
6465 && cd /tmp/geos \
6566 && CFLAGS="-O2 -Wl,-S" CXXFLAGS="-O2 -Wl,-S" ./configure --prefix=$PREFIX \
6667 && make -j $(nproc) --silent && make install && make clean \
6768 && rm -rf /tmp/geos
6869
70+ # proj
71+ ENV PROJ_VERSION=6.1.1
72+ RUN mkdir /tmp/proj \
73+ && curl -sfL http://download.osgeo.org/proj/proj-${PROJ_VERSION}.tar.gz | tar zxf - -C /tmp/proj --strip-components=1 \
74+ && cd /tmp/proj \
75+ && CFLAGS="-O2 -Wl,-S" CXXFLAGS="-O2 -Wl,-S" ./configure --prefix=$PREFIX \
76+ && make && make install && make clean \
77+ && rm -rf /tmp/proj
78+
6979# png
80+ ENV LIBPNG_VERSION=1.6.36
7081RUN mkdir /tmp/png \
7182 && curl -sfL http://prdownloads.sourceforge.net/libpng/libpng-$LIBPNG_VERSION.tar.gz | tar zxf - -C /tmp/png --strip-components=1 \
7283 && cd /tmp/png \
7384 && CFLAGS="-O2 -Wl,-S" CXXFLAGS="-O2 -Wl,-S" ./configure --prefix=$PREFIX \
7485 && make -j $(nproc) --silent && make install && make clean \
7586 && rm -rf /tmp/png
87+ ENV LIBPNG_CONFIG=${PREFIX}/bin/libpng-config
88+ RUN ls -l $LIBPNG_CONFIG
7689
7790# openjpeg
91+ ENV OPENJPEG_VERSION=2.3.1
7892RUN mkdir /tmp/openjpeg \
79- && curl -sfL https://github.com/uclouvain/openjpeg/archive/v$OPENJPEG_VERSION.tar.gz | tar zxf - -C /tmp/openjpeg --strip-components=1 \
93+ && curl -sfL https://github.com/uclouvain/openjpeg/archive/v${ OPENJPEG_VERSION} .tar.gz | tar zxf - -C /tmp/openjpeg --strip-components=1 \
8094 && cd /tmp/openjpeg \
8195 && mkdir build && cd build \
8296 && cmake .. -DBUILD_THIRDPARTY:BOOL=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PREFIX \
8397 && make -j $(nproc) install && make clean \
8498 && rm -rf /tmp/openjpeg
8599
86100# jpeg_turbo
101+ ENV LIBJPEG_TURBO_VERSION=2.0.1
87102RUN mkdir /tmp/jpeg \
88103 && curl -sfL https://github.com/libjpeg-turbo/libjpeg-turbo/archive/${LIBJPEG_TURBO_VERSION}.tar.gz | tar zxf - -C /tmp/jpeg --strip-components=1 \
89104 && cd /tmp/jpeg \
@@ -92,6 +107,7 @@ RUN mkdir /tmp/jpeg \
92107 && rm -rf /tmp/jpeg
93108
94109# webp
110+ ENV WEBP_VERSION=1.0.2
95111RUN mkdir /tmp/webp \
96112 && curl -sfL https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-${WEBP_VERSION}.tar.gz | tar zxf - -C /tmp/webp --strip-components=1 \
97113 && cd /tmp/webp \
@@ -100,15 +116,28 @@ RUN mkdir /tmp/webp \
100116 && rm -rf /tmp/webp
101117
102118# zstd
119+ ENV ZSTD_VERSION=1.3.8
103120RUN mkdir /tmp/zstd \
104121 && curl -sfL https://github.com/facebook/zstd/archive/v${ZSTD_VERSION}.tar.gz | tar zxf - -C /tmp/zstd --strip-components=1 \
105122 && cd /tmp/zstd \
106123 && make -j $(nproc) PREFIX=$PREFIX ZSTD_LEGACY_SUPPORT=0 CFLAGS=-O1 --silent && make install PREFIX=$PREFIX ZSTD_LEGACY_SUPPORT=0 CFLAGS=-O1 && make clean \
107124 && rm -rf /tmp/zstd
108125
109- ENV PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig/
126+ # # geotiff
127+ # ENV GEOTIFF_VERSION=1.5.1
128+ # RUN mkdir /tmp/geotiff \
129+ # && archive="https://github.com/OSGeo/libgeotiff/releases/download/${GEOTIFF_VERSION}/libgeotiff-${GEOTIFF_VERSION}.tar.gz" \
130+ # && curl -sfL ${archive} | tar zxf - -C /tmp/geotiff --strip-components=1 \
131+ # && cd /tmp/geotiff \
132+ # && ./configure --prefix=${PREFIX} \
133+ # --with-proj=${PREFIX} \
134+ # --with-jpeg=${PREFIX} \
135+ # --with-zip=yes \
136+ # && make -j $(nproc) install && make clean \
137+ # && rm -rf /tmp/geotiff
110138
111139# gdal
140+ ENV GDAL_VERSION=2.4.2
112141RUN mkdir /tmp/gdal \
113142 && curl -sfL https://github.com/OSGeo/gdal/archive/v${GDAL_VERSION}.tar.gz | tar zxf - -C /tmp/gdal --strip-components=2
114143
@@ -125,7 +154,9 @@ RUN cd /tmp/gdal \
125154 --with-webp=$PREFIX \
126155 --with-zstd=$PREFIX \
127156 --with-crypto \
157+ # --with-geotiff=$PREFIX \
128158 --with-libtiff=internal \
159+ --with-sqlite3 \
129160 --with-threads \
130161 --disable-debug \
131162 --with-hide-internal-symbols=yes \
@@ -164,7 +195,6 @@ RUN cd /tmp/gdal \
164195 --without-python \
165196 --without-qhull \
166197 --without-sde \
167- --without-sqlite3 \
168198 --without-xerces \
169199 --without-xml2
170200
@@ -186,4 +216,4 @@ ENV PATH=$PREFIX/bin:$PATH
186216# - https://github.com/numpy/numpy/pull/12783/files
187217ENV CFLAGS='-std=c99'
188218RUN pip3 install pip -U && \
189- pip3 install cython numpy "gdal==${GDAL_VERSION}" rasterio --no-binary :all:
219+ pip3 install cython numpy "gdal==${GDAL_VERSION}" pycrs pyproj rasterio shapely --no-binary :all:
0 commit comments