-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathdeploy.sh
executable file
·38 lines (30 loc) · 1 KB
/
deploy.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
# Halt immediately if any command fails:
set -e
# Create a fresh clone of this repository at /tmp:
rm -f /tmp/RecAlign.zip
cd /tmp
git clone git@github.com:tjingrant/RecAlign.git
cd RecAlign
git checkout main
# Compute the sha256 hash of requirements.txt and store it to filename:
filename=$(sha256sum requirements.txt | cut -d' ' -f1)
# Check if a previously packaged version exists based on the sha256 hash of requirements.txt:
if [ -f /tmp/$filename.zip ]; then
echo "Using previously packaged version."
# If not install and package dependency:
else
echo "Packaging dependencies."
# Install dependencies:
pip install -r requirements.txt --target ./package
# Zip the package to a file named as the sha256 hash of requirements.txt:
cd package
zip -r /tmp/$filename.zip .
cd ..
rm -rf package
fi
# Zip the source code:
zip -r /tmp/$filename.zip .
# Clean up:
rm -rf /tmp/RecAlign
mv /tmp/$filename.zip /tmp/RecAlign.zip
echo "Done. The deployment package is at /tmp/RecAlign.zip"