-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·44 lines (41 loc) · 1.35 KB
/
build.sh
File metadata and controls
executable file
·44 lines (41 loc) · 1.35 KB
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
if [ -n "$1" ]; then
l="$1"
else
l=( "add-user" "authorizer" "check-in" "check-out"
"login" "logout" "refresh-token" "me"
"update-me", "add-survey", "access-cleaner")
fi;
OLDPWD="$pwd"
for d in ${l[@]}
do
echo "Working dir $d;"
name=$(echo "${d//-/_}" | awk -F "/" '{print $2}')
echo "Zipping lambda $d"
zipfile=$d/build/code.zip
#rm -rf $d/build
rm -f $zipfile
mkdir -p $d/build/
cp $d/*.py $d/build/
(
cd $d/ 2> /dev/null &&
pip3 install -r requirements.txt -t build/ --upgrade &&
#[ -f "deps.txt" ] && cd build; while IFS= read -r line; do 7za x $line; done < deps.txt &&
cd build && zip -r code.zip *
)
cd "$OLDPWD"
# echo "Zip archive done"
# bucket_name=af-lambda-code;
# echo "Upload code.zip to s3 bucket: $bucket_name with key: $s3key"
# aws s3api put-object --bucket $bucket_name --key $s3key --body $d/$name/code.zip --profile AF
done;
if [ "$2" == "nodejs" ]; then
# pdf-gen
echo "Build pdf-gen function"
cp pdf-gen/*.js pdf-gen/build/;
cp -r pdf-gen/node_modules/ pdf-gen/build/node_modules/;
cd pdf-gen/build && zip -r code.zip * && cd -
echo "Build pdf-print function"
cp pdf-print/*.js pdf-print/build/;
cp -r pdf-print/node_modules/ pdf-print/build/node_modules/;
cd pdf-print/build && zip -r code.zip * && cd -
fi;