forked from extern/egroupware
changes to build additional PHP 7.4 images, also tagging by full version eg. 7.3.12
This commit is contained in:
parent
36913e0627
commit
9e2b72f868
@ -1,18 +1,23 @@
|
||||
################################################################################
|
||||
##
|
||||
## EGroupware FPM container using Ubuntu 18.04 and PHP 7.3 from ondrej/php PPA
|
||||
## EGroupware FPM container using Ubuntu 18.04 and PHP from ondrej/php PPA
|
||||
##
|
||||
################################################################################
|
||||
FROM ubuntu:18.04
|
||||
MAINTAINER rb@egroupware.org
|
||||
|
||||
ARG VERSION=dev-master
|
||||
ARG PHP_VERSION=7.3
|
||||
|
||||
# keeping build-arg in environment for entrypoint.sh
|
||||
ENV VERSION=$VERSION
|
||||
ENV PHP_VERSION=$PHP_VERSION
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y software-properties-common \
|
||||
&& LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php \
|
||||
&& apt-get update \
|
||||
&& bash -c "apt-get install -y php7.3-{cli,mysql,json,gd,xsl,bz2,opcache,apcu,tidy,zip,bcmath,mbstring,smbclient,ldap,curl,fpm,pgsql,gmp}" \
|
||||
&& bash -c "apt-get install -y php$PHP_VERSION-{cli,mysql,json,gd,xsl,bz2,opcache,apcu,tidy,zip,bcmath,mbstring,smbclient,ldap,curl,fpm,pgsql,gmp}" \
|
||||
# fpm and php.ini settings
|
||||
&& sed -e 's/^;\?listen \?=.*/listen = 9000/g' \
|
||||
-e '/allowed_clients/d' \
|
||||
@ -22,7 +27,7 @@ RUN apt-get update \
|
||||
-e 's/^;\?pm.max_requests =.*/pm.max_requests = 30/' \
|
||||
-e 's/^;\?php_admin_value\[memory_limit\].*/php_admin_value[memory_limit] = 172M/' \
|
||||
-e 's/^;\?request_terminate_timeout.*/request_terminate_timeout = 70m/' \
|
||||
-i /etc/php/7.3/fpm/pool.d/www.conf \
|
||||
-i /etc/php/$PHP_VERSION/fpm/pool.d/www.conf \
|
||||
&& sed -e 's/^;\?session.gc_maxlifetime.*/session.gc_maxlifetime = 14400/g' \
|
||||
-e 's|^;\?date.timezone.*|date.timezone = UTC|g' \
|
||||
-e 's|^;\?sys_temp_dir.*|sys_temp_dir = /tmp|g' \
|
||||
@ -33,14 +38,14 @@ RUN apt-get update \
|
||||
-e 's|^;\?max_input_vars \?=.*|max_input_vars = 2000|g' \
|
||||
-e 's|^;\?zlib.output_compression \?=.*|zlib.output_compression = On|g' \
|
||||
-e 's|^;\?opcache.validate_timestamps \?=.*|opcache.validate_timestamps=0|g' \
|
||||
-i /etc/php/7.3/fpm/php.ini \
|
||||
-i /etc/php/$PHP_VERSION/fpm/php.ini \
|
||||
&& sed -e 's|^;\?date.timezone.*|date.timezone = UTC|g' \
|
||||
-e 's|^;\?sys_temp_dir.*|sys_temp_dir = /tmp|g' \
|
||||
-i /etc/php/7.3/cli/php.ini \
|
||||
-i /etc/php/$PHP_VERSION/cli/php.ini \
|
||||
# create directory for pid file
|
||||
&& mkdir -p /run/php \
|
||||
# send logs to stderr to be viewed by docker logs
|
||||
&& ln -s /dev/stderr /var/log/php7.3-fpm.log \
|
||||
&& ln -s /dev/stderr /var/log/php$PHP_VERSION-fpm.log \
|
||||
# install tools to build EGroupware
|
||||
&& apt-get install -y rsync npm zip curl sudo cron patch \
|
||||
&& npm install -g grunt-cli \
|
||||
@ -62,14 +67,15 @@ exit $RESULT' \
|
||||
&& echo "TLS_REQCERT never" >> /etc/ldap/ldap.conf
|
||||
|
||||
# install diverse developper tools, not installed above / in stock container
|
||||
RUN apt-get install -y php7.3-{xdebug,cli} inetutils-ping iproute2 git vim yarn \
|
||||
&& echo "xdebug.remote_enable=1" >> /etc/php/7.3/fpm/conf.d/20-xdebug.ini \
|
||||
&& echo "xdebug.remote_port=9001" >> /etc/php/7.3/fpm/conf.d/20-xdebug.ini \
|
||||
&& echo "xdebug.remote_host=172.17.0.1" >> /etc/php/7.3/fpm/conf.d/20-xdebug.ini \
|
||||
RUN apt-get install -y php$PHP_VERSION-cli php-xdebug inetutils-ping iproute2 git vim yarn \
|
||||
&& echo "xdebug.remote_enable=1" >> /etc/php/$PHP_VERSION/fpm/conf.d/20-xdebug.ini \
|
||||
&& echo "xdebug.remote_port=9001" >> /etc/php/$PHP_VERSION/fpm/conf.d/20-xdebug.ini \
|
||||
&& echo "xdebug.remote_host=172.17.0.1" >> /etc/php/$PHP_VERSION/fpm/conf.d/20-xdebug.ini \
|
||||
&& ln -s /usr/local/bin/composer.phar /usr/local/bin/composer \
|
||||
&& sed -e 's|^;\?opcache.validate_timestamps \?=.*|opcache.validate_timestamps=1|g' \
|
||||
-i /etc/php/7.3/fpm/php.ini \
|
||||
&& apt-get clean
|
||||
-i /etc/php/$PHP_VERSION/fpm/php.ini \
|
||||
&& apt-get clean \
|
||||
&& update-alternatives --install /usr/sbin/php-fpm php-fpm /usr/sbin/php-fpm$PHP_VERSION 5
|
||||
|
||||
VOLUME /var/www
|
||||
VOLUME /var/lib/egroupware
|
||||
@ -79,5 +85,5 @@ EXPOSE 9000
|
||||
|
||||
ADD entrypoint.sh /
|
||||
|
||||
CMD ["php-fpm7.3", "--nodaemonize"]
|
||||
CMD ["php-fpm", "--nodaemonize"]
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
|
@ -1,23 +1,43 @@
|
||||
#!/bin/bash -x
|
||||
|
||||
REPO=egroupware
|
||||
IMAGE=development
|
||||
BASE=ubuntu:18.04
|
||||
RECOMMENDED_PHP_VERSION=7.3
|
||||
|
||||
PHP_VERSION=${1:-7.3}
|
||||
|
||||
TAG=$(docker run --rm -i --entrypoint bash $REPO/$IMAGE -c "apt update && apt search php$PHP_VERSION-fpm" 2>/dev/null|grep php$PHP_VERSION-fpm|sed "s|^php$PHP_VERSION-fpm/bionic.*\(7\.[0-9]*\.[0-9]*\).*|\1|g")
|
||||
test -z "$TAG" && {
|
||||
echo "Can't get new tag of $REPO/$IMAGE container --> existing"
|
||||
exit 1
|
||||
}
|
||||
|
||||
DEFAULT=$(git branch|grep ^*|cut -c3-)
|
||||
TAG=${1:-$DEFAULT}
|
||||
VERSION=$TAG
|
||||
VERSION=${2:-$DEFAULT}
|
||||
BRANCH=$(echo $VERSION|sed 's/\.[0-9]\{8\}$//')
|
||||
[ $VERSION = $BRANCH ] && VERSION="$BRANCH.x-dev"
|
||||
|
||||
[ $BRANCH != "master" ] && {
|
||||
TAG=$BRANCH-$TAG
|
||||
}
|
||||
echo -e "\nbuilding $REPO/$IMAGE:$TAG\n"
|
||||
|
||||
cd $(dirname $0)
|
||||
|
||||
docker pull ubuntu:18.04
|
||||
docker build --build-arg "VERSION=$VERSION" -t egroupware/development:$TAG . && {
|
||||
docker push egroupware/development:$TAG
|
||||
# tag only stable releases as latest
|
||||
[ $TAG != "master" ] && {
|
||||
docker tag egroupware/development:$TAG egroupware/development:latest
|
||||
docker push egroupware/development:latest
|
||||
}
|
||||
[ "$BRANCH" != $VERSION -a "${BRANCH}.x-dev" != $VERSION ] && {
|
||||
docker tag egroupware/development:$VERSION egroupware/development:$BRANCH
|
||||
docker push egroupware/development:$BRANCH
|
||||
docker pull $BASE
|
||||
docker build --build-arg "VERSION=$VERSION" --build-arg="PHP_VERSION=$PHP_VERSION" -t $REPO/$IMAGE:$TAG . && {
|
||||
docker push $REPO/$IMAGE:$TAG
|
||||
|
||||
# tag by major PHP version eg. 7.3
|
||||
docker tag $REPO/$IMAGE:$TAG $REPO/$IMAGE:PHP_VESION
|
||||
docker push $REPO/$IMAGE:$PHP_VERSION
|
||||
|
||||
# tag only recommended PHP version as latest and $BRANCH (eg. master)
|
||||
[ $BRANCH = "master" -a $PHP_VERSION = $RECOMMENDED_PHP_VERSION ] && {
|
||||
docker tag $REPO/$IMAGE:$TAG $REPO/$IMAGE:latest
|
||||
docker push $REPO/$IMAGE:latest
|
||||
docker tag $REPO/$IMAGE:$TAG $REPO/$IMAGE:$BRANCH
|
||||
docker push $REPO/$IMAGE:$BANCH
|
||||
}
|
||||
}
|
||||
|
@ -32,6 +32,7 @@ volumes:
|
||||
cache:
|
||||
services:
|
||||
egroupware:
|
||||
# you can also use tags like: 7.3, 7.3.12 or 7.4
|
||||
image: egroupware/development:master
|
||||
# setting a default language for a new installation
|
||||
#environment:
|
||||
|
@ -2,16 +2,17 @@
|
||||
set -ex
|
||||
|
||||
VERSION=${VERSION:-dev-master}
|
||||
PHP_VERSION=${PHP_VERSION:-7.3}
|
||||
|
||||
# if EGW_SESSION_TIMEOUT is set in environment, propagate value to php.ini
|
||||
test -n "$EGW_SESSION_TIMEOUT" && test "$EGW_SESSION_TIMEOUT" -ge 1440 &&
|
||||
sed -e "s/^;\?session.gc_maxlifetime.*/session.gc_maxlifetime=$EGW_SESSION_TIMEOUT/g" \
|
||||
-i /etc/php/7.3/fpm/php.ini
|
||||
-i /etc/php/$PHP_VERSION/fpm/php.ini
|
||||
|
||||
# if XDEBUG_REMOTE_HOST is set, patch it into xdebug config
|
||||
test -n "$XDEBUG_REMOTE_HOST" && \
|
||||
sed -e "s/^xdebug.remote_host.*/xdebug.remote_host=$XDEBUG_REMOTE_HOST/g" \
|
||||
-i /etc/php/7.3/fpm/conf.d/*xdebug.ini
|
||||
-i /etc/php/$PHP_VERSION/fpm/conf.d/*xdebug.ini
|
||||
|
||||
# downgrade composer to 1.8.6, as 1.9.x does not work with "dev-master" version :(
|
||||
composer selfupdate 1.8.6
|
||||
@ -79,7 +80,7 @@ chmod 600 $LOG
|
||||
max_retries=10
|
||||
export try=0
|
||||
# EGW_SKIP_INSTALL=true skips initial installation (no header.inc.php yet)
|
||||
until [ -n "$EGW_SKIP_INSTALL" -a ! -f /var/www/egroupware/header.inc.php ] || \
|
||||
until [ "$EGW_SKIP_INSTALL" = "allways" -o -n "$EGW_SKIP_INSTALL" -a ! -f /var/www/egroupware/header.inc.php ] || \
|
||||
php /var/www/egroupware/doc/rpm-build/post_install.php \
|
||||
--start_webserver "" --autostart_webserver "" \
|
||||
--start_db "" --autostart_db "" \
|
||||
@ -113,4 +114,4 @@ done 2>&1 | tee -a $LOG
|
||||
# to run async jobs
|
||||
service cron start
|
||||
|
||||
exec "$@"
|
||||
exec php-fpm$PHP_VERSION --nodaemonize
|
Loading…
Reference in New Issue
Block a user