-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
35 lines (28 loc) · 875 Bytes
/
setup.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
#!/bin/bash
# Create and initialize a Python Virtual Environment
echo "Creating virtual env - .env"
virtualenv .env
echo "sourcing virtual env - .env"
source .env/bin/activate
# Create a directory to put things in
echo "Creating 'setup' directory"
mkdir setup
# Move the relevant files into setup directory
echo "Moving creds.json and function file(s) to setup dir"
cp handler.py setup/
cd ./setup
# Install requirements
echo "pip installing requirements from requirements file in target directory"
pip install -r ../requirements.txt -t .
# Prepares the deployment package
echo "Zipping package"
zip -r ../package.zip ./*
# Remove the setup directory used
echo "Removing setup directory and virtual environment"
cd ..
rm -r ./setup
deactivate
rm -r ./.env
# changing dirs back to dir from before
echo "Opening folder containg function package - 'package.zip'"
open .