This repository has been archived by the owner on Apr 11, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
36 lines (30 loc) · 1.73 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
# Here we create a package (like previously with amazonlambda-gdal)
# we use the "-build" image because we don't want need pre-installed libaries
FROM remotepixel/amazonlinux:gdal3.0-py3.7
ENV PACKAGE_PREFIX=/var/task
################################################################################
# CREATE PACKAGE #
################################################################################
COPY handler.py ${PACKAGE_PREFIX}/handler.py
RUN pip install numpy rasterio mercantile --no-binary :all: -t ${PACKAGE_PREFIX}/
################################################################################
# REDUCE PACKAGE SIZE #
################################################################################
RUN rm -rdf $PACKAGE_PREFIX/boto3/ \
&& rm -rdf $PACKAGE_PREFIX/botocore/ \
&& rm -rdf $PACKAGE_PREFIX/docutils/ \
&& rm -rdf $PACKAGE_PREFIX/dateutil/ \
&& rm -rdf $PACKAGE_PREFIX/jmespath/ \
&& rm -rdf $PACKAGE_PREFIX/s3transfer/ \
&& rm -rdf $PACKAGE_PREFIX/numpy/doc/
RUN rm -rdf $PREFIX/share/doc \
&& rm -rdf $PREFIX/share/man \
&& rm -rdf $PREFIX/share/hdf*
# Strip shared libraries
RUN cd $PREFIX && find lib -name \*.so\* -exec strip {} \;
################################################################################
# CREATE ARCHIVE #
################################################################################
RUN cd $PACKAGE_PREFIX && zip -r9q /tmp/package.zip *
RUN cd $PREFIX && zip -r9q --symlinks /tmp/package.zip lib/*.so* share
RUN cd $PREFIX && zip -r9q --symlinks /tmp/package.zip bin/gdal* bin/ogr* bin/geos* bin/nearblack