This repository has been archived by the owner on Jun 14, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
switch back to gdal2.4 and use lambda layer
- Loading branch information
1 parent
c98ec80
commit f8164c8
Showing
9 changed files
with
135 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
FROM remotepixel/amazonlinux:gdal3.0-py3.7 | ||
FROM remotepixel/amazonlinux:gdal2.4-py3.7-geo | ||
|
||
WORKDIR /tmp | ||
|
||
ENV PACKAGE_PREFIX /tmp/python | ||
ENV PYTHONUSERBASE=/var/task | ||
|
||
COPY setup.py setup.py | ||
COPY remotepixel_tiler/ remotepixel_tiler/ | ||
COPY setup.py setup.py | ||
|
||
# Install dependencies | ||
RUN pip3 install . --no-binary numpy,rasterio -t $PACKAGE_PREFIX -U | ||
RUN pip3 install . --user | ||
RUN rm -rf remotepixel_tiler setup.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,15 @@ | ||
#!/bin/bash | ||
echo "-----------------------" | ||
echo "Creating lambda package ${PACKAGE_PATH}" | ||
echo "Creating lambda package" | ||
echo "-----------------------" | ||
echo | ||
echo "Remove lambda python packages" | ||
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/ | ||
|
||
echo "Remove uncompiled python scripts" | ||
find $PACKAGE_PREFIX -type f -name '*.pyc' | while read f; do n=$(echo $f | sed 's/__pycache__\///' | sed 's/.cpython-[2-3][0-9]//'); cp $f $n; done; | ||
find $PACKAGE_PREFIX -type d -a -name '__pycache__' -print0 | xargs -0 rm -rf | ||
find $PACKAGE_PREFIX -type d -a -name 'tests' -print0 | xargs -0 rm -rf | ||
find $PACKAGE_PREFIX -type f -a -name '*.py' -print0 | xargs -0 rm -f | ||
|
||
echo "Strip shared libraries" | ||
cd $PREFIX && find lib -name \*.so\* -exec strip {} \; | ||
# Leave module precompiles for faster Lambda startup | ||
cd ${PYTHONUSERBASE}/lib/python3.7/site-packages/ | ||
find . -type f -name '*.pyc' | while read f; do n=$(echo $f | sed 's/__pycache__\///' | sed 's/.cpython-[2-3][0-9]//'); cp $f $n; done; | ||
find . -type d -a -name '__pycache__' -print0 | xargs -0 rm -rf | ||
find . -type f -a -name '*.py' -print0 | xargs -0 rm -f | ||
|
||
echo "Create archive" | ||
cd $PACKAGE_PREFIX && zip -r9q /tmp/package.zip * | ||
cd $PREFIX && zip -r9q --symlinks /tmp/package.zip lib/*.so* share | ||
zip -r9q /tmp/package.zip * | ||
|
||
cp /tmp/package.zip ${PACKAGE_PATH} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
version: '3' | ||
|
||
services: | ||
landsat: | ||
build: . | ||
ports: | ||
- "8000:8000" | ||
volumes: | ||
- '.:/local' | ||
environment: | ||
- AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} | ||
- AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} | ||
- CPL_TMPDIR=/tmp | ||
- CPL_VSIL_CURL_ALLOWED_EXTENSIONS=.TIF,.ovr | ||
- GDAL_CACHEMAX=75% | ||
- GDAL_DISABLE_READDIR_ON_OPEN=FALSE | ||
- GDAL_HTTP_MERGE_CONSECUTIVE_RANGES=YES | ||
- GDAL_HTTP_MULTIPLEX=YES | ||
- GDAL_HTTP_VERSION=2 | ||
- TOKEN=${SECRET_TOKEN} | ||
- VSI_CACHE_SIZE=536870912 | ||
- VSI_CACHE=TRUE | ||
command: > | ||
bash -c "/var/task/bin/remotepixel-tiler landsat" | ||
cbers: | ||
build: . | ||
ports: | ||
- "8000:8000" | ||
volumes: | ||
- '.:/local' | ||
environment: | ||
- AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} | ||
- AWS_REQUEST_PAYER=requester | ||
- AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} | ||
- CPL_TMPDIR=/tmp | ||
- CPL_VSIL_CURL_ALLOWED_EXTENSIONS=.tif | ||
- GDAL_CACHEMAX=75% | ||
- GDAL_DISABLE_READDIR_ON_OPEN=EMPTY_DIR | ||
- GDAL_HTTP_MERGE_CONSECUTIVE_RANGES=YES | ||
- GDAL_HTTP_MULTIPLEX=YES | ||
- GDAL_HTTP_VERSION=2 | ||
- TOKEN=${SECRET_TOKEN} | ||
- VSI_CACHE_SIZE=536870912 | ||
- VSI_CACHE=TRUE | ||
command: > | ||
bash -c "/var/task/bin/remotepixel-tiler cbers" | ||
sentinel: | ||
build: . | ||
ports: | ||
- "8000:8000" | ||
volumes: | ||
- '.:/local' | ||
environment: | ||
- AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} | ||
- AWS_REQUEST_PAYER=requester | ||
- AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} | ||
- CPL_TMPDIR=/tmp | ||
- CPL_VSIL_CURL_ALLOWED_EXTENSIONS=.jp2,.tif | ||
- GDAL_CACHEMAX=75% | ||
- GDAL_DISABLE_READDIR_ON_OPEN=EMPTY_DIR | ||
- GDAL_HTTP_MERGE_CONSECUTIVE_RANGES=YES | ||
- GDAL_HTTP_MULTIPLEX=YES | ||
- GDAL_HTTP_VERSION=2 | ||
- TOKEN=${SECRET_TOKEN} | ||
- VSI_CACHE_SIZE=536870912 | ||
- VSI_CACHE=TRUE | ||
command: > | ||
bash -c "/var/task/bin/remotepixel-tiler sentinel" | ||
cogeo: | ||
build: . | ||
ports: | ||
- "8000:8000" | ||
volumes: | ||
- '.:/local' | ||
environment: | ||
- AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} | ||
- AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} | ||
- CPL_TMPDIR=/tmp | ||
- CPL_VSIL_CURL_ALLOWED_EXTENSIONS=.tif | ||
- GDAL_CACHEMAX=75% | ||
- GDAL_DISABLE_READDIR_ON_OPEN=EMPTY_DIR | ||
- GDAL_HTTP_MERGE_CONSECUTIVE_RANGES=YES | ||
- GDAL_HTTP_MULTIPLEX=YES | ||
- GDAL_HTTP_VERSION=2 | ||
- TOKEN=${SECRET_TOKEN} | ||
- VSI_CACHE_SIZE=536870912 | ||
- VSI_CACHE=TRUE | ||
command: > | ||
bash -c "/var/task/bin/remotepixel-tiler cogeo" | ||
bash: | ||
build: . | ||
volumes: | ||
- '.:/local' | ||
environment: | ||
- AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} | ||
- AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} | ||
command: /bin/bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters