-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathMakefile
58 lines (46 loc) · 1.5 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
image:
docker build -t lambda-ruby2.5-postgresql10 .
shell:
docker run --rm -it -v $$PWD:/var/task -w /var/task lambda-ruby2.5-postgresql10
install:
docker run --rm -it -v $$PWD:/var/task -w /var/task lambda-ruby2.5-postgresql10 make _install
test:
docker run --rm -it -v $$PWD:/var/task -w /var/task lambda-ruby2.5-postgresql10 make _test
zip:
rm -f deploy.zip
zip -q -r deploy.zip . -x .git/\*
clean:
rm -rf .bundle/
rm -rf vendor/
rm -rf lib/
deploy:
aws lambda create-function \
--region ap-southeast-2 \
--function-name RubyLambdaPostgreSQLNokogiri \
--zip-file fileb://deploy.zip \
--runtime ruby2.5 \
--role arn:aws:iam::000000000000:role/lambda-execution-role \
--timeout 20 \
--handler handler.main
update:
aws lambda update-function-code \
--region ap-southeast-2 \
--function-name RubyLambdaPostgreSQLNokogiri \
--zip-file fileb://deploy.zip
delete:
aws lambda delete-function \
--region ap-southeast-2 \
--function-name RubyLambdaPostgreSQLNokogiri
invoke:
aws lambda invoke \
--region ap-southeast-2 \
--function-name RubyLambdaPostgreSQLNokogiri /dev/stdout
# Commands that start with underscore are run *inside* the container.
_install:
bundle config --local build.pg --with-pg-config=/usr/pgsql-10/bin/pg_config
bundle config --local silence_root_warning true
bundle install --path vendor/bundle --clean
mkdir -p /var/task/lib
cp -a /usr/pgsql-10/lib/*.so.* /var/task/lib/
_test:
ruby -e "require 'handler'; puts main(event: nil, context: nil)"