2019-07-19 10:07:43 +02:00
|
|
|
#!/bin/bash -x
|
2021-04-01 08:49:44 +02:00
|
|
|
# To build PHP 8 snapshots out of master: doc/docker/fpm/build.sh 8.0 21.1.<date> master
|
2019-07-19 10:07:43 +02:00
|
|
|
|
2021-03-24 08:53:49 +01:00
|
|
|
cd $(dirname $0)
|
|
|
|
|
|
|
|
DEFAULT_PHP_VERSION=7.4
|
|
|
|
PHP_VERSION=$DEFAULT_PHP_VERSION
|
|
|
|
|
|
|
|
if [[ $1 =~ ^[78]\.[0-9]$ ]]
|
|
|
|
then
|
|
|
|
PHP_VERSION=$1
|
|
|
|
shift
|
|
|
|
fi
|
|
|
|
|
2019-08-09 18:31:43 +02:00
|
|
|
DEFAULT=$(git branch|grep ^*|cut -c3-)
|
|
|
|
TAG=${1:-$DEFAULT}
|
2021-04-01 08:49:44 +02:00
|
|
|
VERSION=${2:-$TAG}
|
2019-08-09 18:31:43 +02:00
|
|
|
BRANCH=$(echo $VERSION|sed 's/\.[0-9]\{8\}$//')
|
2021-04-01 08:49:44 +02:00
|
|
|
[ $VERSION = $BRANCH ] && VERSION="dev-$BRANCH"
|
2019-07-19 10:07:43 +02:00
|
|
|
|
2021-04-01 08:49:44 +02:00
|
|
|
[ $VERSION = "dev-$DEFAULT" ] && (
|
|
|
|
cd ../../..
|
|
|
|
composer update 'egroupware/*'
|
2019-07-19 10:07:43 +02:00
|
|
|
git status composer.lock|grep composer.lock && {
|
|
|
|
git stash; git pull --rebase; git stash pop
|
|
|
|
git commit -m 'updating composer.lock with latest commit hashed for egroupware/* packages' composer.lock
|
2019-08-09 18:31:43 +02:00
|
|
|
VERSION="$VERSION#$(git push|grep $DEFAULT|cut -c4-10)"
|
2019-07-19 10:07:43 +02:00
|
|
|
}
|
2021-04-01 08:49:44 +02:00
|
|
|
)
|
2019-07-19 10:07:43 +02:00
|
|
|
|
2021-03-24 08:53:49 +01:00
|
|
|
# add PHP_VERSION to TAG, if not the default PHP version
|
|
|
|
[ $PHP_VERSION != $DEFAULT_PHP_VERSION ] && TAG=$TAG-$PHP_VERSION
|
2019-07-19 10:07:43 +02:00
|
|
|
|
2020-07-31 17:52:11 +02:00
|
|
|
docker pull ubuntu:20.04
|
2021-03-24 08:53:49 +01:00
|
|
|
docker build --no-cache --build-arg "VERSION=$VERSION" --build-arg "PHP_VERSION=$PHP_VERSION" -t egroupware/egroupware:$TAG . && {
|
2019-07-19 10:07:43 +02:00
|
|
|
docker push egroupware/egroupware:$TAG
|
2021-03-24 08:53:49 +01:00
|
|
|
# further tags are only for the default PHP version
|
|
|
|
[ $PHP_VERSION != $DEFAULT_PHP_VERSION ] && exit
|
2019-07-19 10:07:43 +02:00
|
|
|
# tag only stable releases as latest
|
2020-05-25 15:29:57 +02:00
|
|
|
#[ $TAG != "master" ] && {
|
|
|
|
# docker tag egroupware/egroupware:$TAG egroupware/egroupware:latest
|
|
|
|
# docker push egroupware/egroupware:latest
|
|
|
|
#}
|
2021-04-01 08:49:44 +02:00
|
|
|
[ "$BRANCH" != $VERSION -a "dev-${BRANCH}" != $VERSION ] && {
|
2021-03-24 08:53:49 +01:00
|
|
|
docker tag egroupware/egroupware:$TAG egroupware/egroupware:$BRANCH
|
2019-07-19 10:07:43 +02:00
|
|
|
docker push egroupware/egroupware:$BRANCH
|
|
|
|
}
|
|
|
|
}
|