Skip to content

Commit bf53df3

Browse files
committed
Version 2
1 parent 3a11ae2 commit bf53df3

28 files changed

+1428
-103
lines changed

deployment/build-s3-dist.sh

100644100755
Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# This script should be run from the repo's deployment directory
1313
# cd deployment
1414
# ./build-s3-dist.sh source-bucket-base-name
15-
# source-bucket-base-name should be the base name for the S3 bucket location where the template will source the Lambda code from.
15+
# source-bucket-base-name should be the base name for the S3 bucket location where the template will source the Lambda code from.
1616
# The template will append '-[region_name]' to this bucket name.
1717
# For example: ./build-s3-dist.sh solutions
1818
# The template will then expect the source code to be located in the solutions-[region_name] bucket
@@ -25,6 +25,8 @@ fi
2525

2626
# Build source
2727
echo "Staring to build distribution"
28+
echo "export deployment_dir=`pwd`"
29+
export deployment_dir=`pwd`
2830
echo "mkdir -p dist"
2931
mkdir -p dist
3032
echo "cp -f serverless-image-handler.template dist"
@@ -33,18 +35,37 @@ echo "Updating code source bucket in template with $1"
3335
replace="s/%%BUCKET_NAME%%/$1/g"
3436
echo "sed -i '' -e $replace dist/serverless-image-handler.template"
3537
sed -i '' -e $replace dist/serverless-image-handler.template
36-
cd dist
38+
echo "Creating UI ZIP file"
39+
cd $deployment_dir/../source/ui
40+
zip -q -r9 $deployment_dir/dist/serverless-image-handler-ui.zip *
41+
echo "Building custom resource package ZIP file"
42+
cd $deployment_dir/dist
43+
pwd
44+
echo "virtualenv env"
45+
virtualenv env
46+
echo "source env/bin/activate"
47+
source env/bin/activate
48+
echo "pip install $deployment_dir/../source/image-handler-custom-resource/. --target=$deployment_dir/dist/env/lib/python2.7/site-packages/"
49+
pip install $deployment_dir/../source/image-handler-custom-resource/. --target=$deployment_dir/dist/env/lib/python2.7/site-packages/
50+
cd $deployment_dir/dist/env/lib/python2.7/site-packages/
51+
zip -r9 $deployment_dir/dist/serverless-image-handler-custom-resource.zip *
52+
cd $deployment_dir/dist
53+
zip -q -d serverless-image-handler-custom-resource.zip pip*
54+
zip -q -d serverless-image-handler-custom-resource.zip easy*
55+
rm -rf env
56+
echo "Building Image Handler package ZIP file"
57+
cd $deployment_dir/dist
3758
pwd
3859
echo "virtualenv env"
3960
virtualenv env
4061
echo "source env/bin/activate"
4162
source env/bin/activate
4263
cd ../..
4364
pwd
44-
echo "pip install source/. --target=$VIRTUAL_ENV/lib/python2.7/site-packages/"
45-
pip install source/. --target=$VIRTUAL_ENV/lib/python2.7/site-packages/
46-
echo "pip install -r source/requirements.txt --target=$VIRTUAL_ENV/lib/python2.7/site-packages/"
47-
pip install -r source/requirements.txt --target=$VIRTUAL_ENV/lib/python2.7/site-packages/
65+
echo "pip install source/image-handler/. --target=$VIRTUAL_ENV/lib/python2.7/site-packages/"
66+
pip install source/image-handler/. --target=$VIRTUAL_ENV/lib/python2.7/site-packages/
67+
echo "pip install -r source/image-handler/requirements.txt --target=$VIRTUAL_ENV/lib/python2.7/site-packages/"
68+
pip install -r source/image-handler/requirements.txt --target=$VIRTUAL_ENV/lib/python2.7/site-packages/
4869
cd $VIRTUAL_ENV
4970
pwd
5071
echo "git clone git://github.com/pornel/pngquant.git pngquant_s"
@@ -66,7 +87,6 @@ pwd
6687
echo "zip -q -g $VIRTUAL_ENV/../serverless-image-handler.zip pngquant"
6788
zip -q -g $VIRTUAL_ENV/../serverless-image-handler.zip pngquant
6889
cd ..
69-
echo zip -d serverless-image-handler.zip botocore*
7090
zip -q -d serverless-image-handler.zip pip*
7191
zip -q -d serverless-image-handler.zip easy*
7292
echo "Clean up build material"

0 commit comments

Comments
 (0)