This repository has been archived by the owner on Nov 29, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
68 lines (54 loc) · 1.96 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
65
66
67
68
aws_profile ?= "staging"
pwd = $(PWD)
exts_file_name = mysql_ext.zip
vendor_file_name = vendor.zip
zip:
rm -f tmp/deploy.zip
zip -q -r tmp/deploy.zip . -x .git/\*
zip_mysql:
echo "Packing compiled native extensions"
zip -r $(exts_file_name) ./ruby/
zip_vendor:
echo "Packaging vendor folder"
zip -r $(vendor_file_name) ./vendor/bundle
clean:
rm -rf .bundle/*
rm -rf tmp/*
rm -rf ruby/*
rm -rf vendor
rm -f $(exts_file_name)
rm -f $(vendor_file_name)
compile_vendor:
docker run --rm -v "$(pwd)":/var/task lambci/lambda:build-ruby2.5 bundle install --path="vendor/bundle" --without development test
compile_exts_old:
docker run --rm -v "$(pwd)":/var/task lambci/lambda:build-ruby2.5 bundle install --path=. --gemfile Gemfile.exts
compile_mysql:
docker run -v "$(pwd)":/var/task -it lambci/lambda:build-ruby2.5 /bin/bash \
-c "yum -y install mysql-devel ; bundle install --path=. --gemfile Gemfile.exts"
build_mysql:
docker run -v "$(pwd)":/var/task -it lambci/lambda:build-ruby2.5 /bin/bash \
-c "yum -y install mysql-devel ; bundle install --path=. --gemfile Gemfile.exts; cp /usr/lib64/mysql/libmysqlclient.so.18 lib/;"
publish_vendor_layer:
echo "Publishing vendor layer"
aws lambda publish-layer-version \
--profile $(aws_profile) \
--layer-name genoserv-vendor-layer \
--description "production gems" \
--license-info "Creditshelf" \
--compatible-runtimes ruby2.5 \
--zip-file fileb://$(pwd)/$(vendor_file_name)
publish_mysql_layer:
echo "Publishing new layer"
aws lambda publish-layer-version \
--profile $(aws_profile) \
--layer-name mysql_0_5_1 \
--description "Mysql native extension, version ~> 0.5.1" \
--license-info "Creditshelf" \
--compatible-runtimes ruby2.5 \
--zip-file fileb://$(pwd)/$(exts_file_name)
deploy_mysql_layer: clean compile_mysql zip_mysql publish_mysql_layer
echo "Done"
deploy_vendor: clean compile_vendor zip_vendor publish_vendor_layer
echo "Done"
deploy: clean
SLS_DEBUG=* sls deploy --stage=$(aws_profile)