forked from crocodilestick/Calibre-Web-Automated
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
53 lines (43 loc) · 1.35 KB
/
build.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
#!/bin/bash
# Enter location for cwa repo files below
REPO_DIR="/home/cwa-repo-download"
# Enter your DockerHub username here
DH_USER="crocodilestick"
# Use the following guide to set up buildx on your own system to build multi-platform images
# https://a-berahman.medium.com/simplifying-docker-multiplatform-builds-with-buildx-3d7efd670f58
rm -r -f $REPO_DIR
git clone http://github.com/crocodilestick/calibre-web-automated.git $REPO_DIR
cd $REPO_DIR
echo
echo Enter Version Number\: \(Convention is e.g. V2.0.1\)
read version
echo Dev or Production Image? Enter \'dev\' or \'prod\' to choose:
while true ; do
read type
case $type in
dev | Dev | DEV)
type="dev"
echo Enter test version number\:
read testnum
break
;;
prod | Prod | PROD)
type="prod"
break
;;
*)
echo Invalid entry. Please try again.
;;
esac
done
NOW="$(date +"%Y-%m-%d %H:%M:%S")"
if [ type == "dev" ]; then
docker build --tag $DH_USER/calibre-web-automated:dev --build-arg="BUILD_DATE=$NOW" --build-arg="VERSION=$version-TEST-$testnum" .
echo
echo "Dev image Version $version - Test $testnum created! Exiting now... "
else
docker build --tag $DH_USER/calibre-web-automated:$version --build-arg="BUILD_DATE=$NOW" --build-arg="VERSION=$version" .
echo
echo "Prod image Version $version created! Exiting now..."
fi
cd