-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_docker7.sh
executable file
·94 lines (83 loc) · 5.31 KB
/
build_docker7.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/sh
AMPACHEDIR=$PWD
BRANCH="all"
if [ ! $# -eq 0 ]; then
BRANCH=$1
fi
if [ $BRANCH = "master" ] || [ $BRANCH = "stable" ] || [ $BRANCH = "nosql" ] || [ $BRANCH = "all" ]; then
RELEASEVERSION=`grep -oP '[0-9]+\.[0-9]+\.[0-9]+' ./ampache-develop/src/Config/Init/InitializationHandlerConfig.php`
status=$(curl --head --silent https://github.com/ampache/ampache/releases/download/${RELEASEVERSION}/ampache-${RELEASEVERSION}_all_php8.2.zip | head -n 1)
if echo "$status" | grep -q 404; then
read -p "Failed to find $RELEASEVERSION... Enter Ampache Version: " RELEASEVERSION
fi
fi
echo $RELEASEVERSION
if [ ! -d $AMPACHEDIR/docker ]; then
mkdir $AMPACHEDIR/docker
fi
# MASTER
if [ $BRANCH = "master" ] || [ $BRANCH = "stable" ] || [ $BRANCH = "all" ]; then
if [ ! -d $AMPACHEDIR/docker/ampache-docker/ ]; then
cd $AMPACHEDIR/docker && git clone -b master https://github.com/ampache/ampache-docker.git ampache-docker
fi
if [ ! -f $AMPACHEDIR/docker/ampache-docker/Dockerfile ]; then
rm -rf $AMPACHEDIR/docker/ampache-docker
cd $AMPACHEDIR/docker && git clone -b master https://github.com/ampache/ampache-docker.git ampache-docker
fi
cd $AMPACHEDIR/docker/ampache-docker/ && git checkout master && git reset --hard origin/master && git pull && docker buildx build --no-cache --platform linux/amd64,linux/arm64,linux/arm/v7 --build-arg VERSION=${RELEASEVERSION} -t ampache/ampache:7 -t ampache/ampache:${RELEASEVERSION} -t ampache/ampache:latest --push . &
fi
# NOSQL
if [ $BRANCH = "nosql" ] || [ $BRANCH = "stable" ] || [ $BRANCH = "all" ]; then
if [ ! -d $AMPACHEDIR/docker/ampache-docker-nosql/ ]; then
cd $AMPACHEDIR/docker && git clone -b nosql https://github.com/ampache/ampache-docker.git ampache-docker-nosql
fi
if [ ! -f $AMPACHEDIR/docker/ampache-docker-nosql/Dockerfile ]; then
rm -rf $AMPACHEDIR/docker/ampache-docker-nosql
cd $AMPACHEDIR/docker && git clone -b nosql https://github.com/ampache/ampache-docker.git ampache-docker-nosql
fi
cd $AMPACHEDIR/docker/ampache-docker-nosql/ && git checkout nosql && git reset --hard origin/nosql && git pull && docker buildx build --no-cache --platform linux/amd64,linux/arm64,linux/arm/v7 --build-arg VERSION=${RELEASEVERSION} -t ampache/ampache:nosql7 -t ampache/ampache:nosql${RELEASEVERSION} -t ampache/ampache:nosql --push . &
fi
# DEVELOP
if [ $BRANCH = "develop" ] || [ $BRANCH = "all" ]; then
# DEFAULT
if [ ! -d $AMPACHEDIR/docker/ampache-docker-develop/ ]; then
cd $AMPACHEDIR/docker && git clone -b develop https://github.com/ampache/ampache-docker.git ampache-docker-develop
fi
if [ ! -f $AMPACHEDIR/docker/ampache-docker-develop/Dockerfile ]; then
rm -rf $AMPACHEDIR/docker/ampache-docker-develop
cd $AMPACHEDIR/docker && git clone -b develop https://github.com/ampache/ampache-docker.git ampache-docker-develop
fi
cd $AMPACHEDIR/docker/ampache-docker-develop/ && git checkout develop && git reset --hard origin/develop && git pull && docker buildx build --no-cache --platform linux/amd64,linux/arm64,linux/arm/v7 -t ampache/ampache:develop -t ampache/ampache:preview --push . &
# NOSQL
if [ ! -d $AMPACHEDIR/docker/ampache-docker-nosql-develop/ ]; then
cd $AMPACHEDIR/docker && git clone -b nosql-develop https://github.com/ampache/ampache-docker.git ampache-docker-nosql-develop
fi
if [ ! -f $AMPACHEDIR/docker/ampache-docker-nosql-develop/Dockerfile ]; then
rm -rf $AMPACHEDIR/docker/ampache-docker-nosql-develop
cd $AMPACHEDIR/docker && git clone -b nosql-develop https://github.com/ampache/ampache-docker.git ampache-docker-nosql-develop
fi
cd $AMPACHEDIR/docker/ampache-docker-nosql-develop/ && git checkout nosql-develop && git reset --hard origin/nosql-develop && git pull && docker buildx build --no-cache --platform linux/amd64,linux/arm64,linux/arm/v7 -t ampache/ampache:nosql-develop -t ampache/ampache:nosql-preview --push . &
fi
# PREVIEW
if [ $BRANCH = "preview" ]; then
# DEFAULT
if [ ! -d $AMPACHEDIR/docker/ampache-docker-preview/ ]; then
cd $AMPACHEDIR/docker && git clone -b preview https://github.com/ampache/ampache-docker.git ampache-docker-preview
fi
if [ ! -f $AMPACHEDIR/docker/ampache-docker-preview/Dockerfile ]; then
rm -rf $AMPACHEDIR/docker/ampache-docker-preview
cd $AMPACHEDIR/docker && git clone -b preview https://github.com/ampache/ampache-docker.git ampache-docker-preview
fi
cd $AMPACHEDIR/docker/ampache-docker-preview/ && git checkout preview && git reset --hard origin/preview && git pull && docker buildx build --no-cache --platform linux/amd64,linux/arm64,linux/arm/v7 -t ampache/ampache:preview --push . &
# NOSQL
if [ ! -d $AMPACHEDIR/docker/ampache-docker-nosql-preview/ ]; then
cd $AMPACHEDIR/docker && git clone -b nosql-preview https://github.com/ampache/ampache-docker.git ampache-docker-nosql-preview
fi
if [ ! -f $AMPACHEDIR/docker/ampache-docker-nosql-preview/Dockerfile ]; then
rm -rf $AMPACHEDIR/docker/ampache-docker-nosql-preview
cd $AMPACHEDIR/docker && git clone -b nosql-preview https://github.com/ampache/ampache-docker.git ampache-docker-nosql-preview
fi
cd $AMPACHEDIR/docker/ampache-docker-nosql-preview/ && git checkout nosql-preview && git reset --hard origin/nosql-preview && git pull && docker buildx build --no-cache --platform linux/amd64,linux/arm64,linux/arm/v7 -t ampache/ampache:nosql-preview --push . &
fi
# go home
cd $AMPACHEDIR