forked from vincentsarago/lambda-tiler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
64 lines (52 loc) · 2.25 KB
/
Makefile
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
SHELL = /bin/bash
all: build package
build:
docker build --tag lambda:latest .
package:
docker run \
-w /var/task/ \
--name lambda \
-itd \
lambda:latest
docker cp lambda:/tmp/package.zip package.zip
docker stop lambda
docker rm lambda
shell:
docker run \
--name lambda \
--volume $(shell pwd)/:/data \
--env PYTHONPATH=/var/task/vendored \
--env GDAL_CACHEMAX=75% \
--env GDAL_DISABLE_READDIR_ON_OPEN=TRUE \
--env GDAL_TIFF_OVR_BLOCKSIZE=512 \
--env VSI_CACHE=TRUE \
--env VSI_CACHE_SIZE=536870912 \
--rm \
-it \
lambda:latest /bin/bash
test:
docker run \
-w /var/task/ \
--name lambda \
--env AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} \
--env AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} \
--env AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} \
--env AWS_REGION=us-east-1 \
--env PYTHONPATH=/var/task \
--env GDAL_CACHEMAX=75% \
--env GDAL_DISABLE_READDIR_ON_OPEN=TRUE \
--env GDAL_TIFF_OVR_BLOCKSIZE=512 \
--env VSI_CACHE=TRUE \
--env VSI_CACHE_SIZE=536870912 \
-itd \
lambda:latest
docker exec -it lambda bash -c 'unzip -q /tmp/package.zip -d /var/task/'
docker exec -it lambda bash -c 'pip3 install boto3 jmespath python-dateutil -t /var/task'
docker exec -it lambda python3 -c 'from app.handler import APP; assert APP({"path": "/bounds", "queryStringParameters": {"url": "https://oin-hotosm.s3.amazonaws.com/5ac626e091b5310010e0d482/0/5ac626e091b5310010e0d483.tif"}, "pathParameters": "null", "requestContext": "null", "httpMethod": "GET"}, None)'
docker exec -it lambda python3 -c 'from app.handler import APP; assert APP({"path": "/processing/19/319379/270522.png", "queryStringParameters": {"url": "https://oin-hotosm.s3.amazonaws.com/5ac626e091b5310010e0d482/0/5ac626e091b5310010e0d483.tif", "ratio":"(b3-b2)/(b3+b2)"}, "pathParameters": "null", "requestContext": "null", "httpMethod": "GET"}, None)'
docker exec -it lambda python3 -c 'from app.handler import APP; assert APP({"path": "/tiles/19/319379/270522.png", "queryStringParameters": {"url": "https://oin-hotosm.s3.amazonaws.com/5ac626e091b5310010e0d482/0/5ac626e091b5310010e0d483.tif"}, "pathParameters": "null", "requestContext": "null", "httpMethod": "GET"}, None)'
docker stop lambda
docker rm lambda
clean:
docker stop lambda
docker rm lambda