-
Notifications
You must be signed in to change notification settings - Fork 1
/
pack.sh
executable file
·48 lines (42 loc) · 1.1 KB
/
pack.sh
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
#!/bin/bash
name=$1
if [ $name == "thumb_create" ]; then
rm -f ./dist/$name.zip
zip -r ./dist/$name.zip $name.py
exit 0
fi
if [ $name == "thumb_delete" ]; then
rm -f ./dist/$name.zip
zip -r ./dist/$name.zip $name.py
exit 0
fi
if [ $name == "python_layer" ]; then
virtualenv venv --python=python3.8
source venv/bin/activate
pip install Pillow
pip freeze > requirements.txt
docker run --rm \
--volume=$(pwd):/lambda-build \
-w=/lambda-build \
lambci/lambda:build-python3.8 \
pip install -r requirements.txt --target python
rm -f ./dist/$name.zip
zip -r ./dist/$name.zip ./python/
rm -rf ./python ./venv ./requirements.txt
deactivate
exit 0
fi
if [ $name == "ffmpeg_layer" ]; then
wget --progress=dot:mega https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz
tar xvf ffmpeg-release-amd64-static.tar.xz
mkdir -p ffmpeg/bin
mv ffmpeg-4.4-amd64-static/ffmpeg ffmpeg/bin/
rm -f ./dist/$name.zip
cd ffmpeg
zip -r ../dist/$name.zip .
cd ..
rm -rf ./ffmpeg-4.4-amd64-static ./ffmpeg ./ffmpeg-release-amd64-static.tar.xz
exit 0
fi
echo "invalid name of function"
exit 1