forked from crramirez/limesurvey
-
Notifications
You must be signed in to change notification settings - Fork 50
/
update.sh
executable file
·55 lines (32 loc) · 1.44 KB
/
update.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
49
50
51
52
53
54
55
#!/bin/bash
#Fail on any error
set -e
#extract version from URL
VERSION=`echo $1 | sed 's|.*limesurvey\([0-9\.]*\)\+.*|\1|'`
curl "$1" > $VERSION.zip
SHA256=`sha256sum $VERSION.zip | awk '{print $1}'`
rm docker-compose.yml
sed -e "s/LIME_VER/$VERSION/g" docker-compose.yml.template > docker-compose.yml
rm Dockerfile
sed -e "s|LIME_URL|$1|g" Dockerfile.template > Dockerfile
sed -i -e "s/LIME_SHA/$SHA256/g" Dockerfile
rm $VERSION.zip
#local build first for testing
docker pull php:8.1-apache
docker build . --load -t adamzammit/limesurvey:$VERSION
docker-compose down
rm -rf sessions upload plugins config mysql
docker-compose up -d
sleep 60
curl -v --silent localhost:8082 2>&1 | grep 'HTTP/1.1 200 OK' && status=success || status=fail
curl -v --silent localhost:8082 2>&1 | grep 'LimeSurvey' && status2=success || status2=fail
docker-compose down
if [ "$status" == "success" ] && [ "$status2" == "success" ]; then
docker buildx build --no-cache --pull --push --platform linux/amd64,linux/arm64,linux/mips64le,linux/arm/v7,linux/arm/v6 -t adamzammit/limesurvey:$VERSION -t adamzammit/limesurvey:latest -t acspri/limesurvey:$VERSION -t acspri/limesurvey:latest .
git add Dockerfile docker-compose.yml
git commit -m "$VERSION release"
git tag $VERSION
git push --tags origin master
else
echo "Did not commit or push build: acspri/limesurvey:$VERSION due to error" | mail -s "Error in build $VERSION" [email protected]
fi