From d88216d49833b51eb4d8c938a071299b5cae83fb Mon Sep 17 00:00:00 2001 From: root Date: Wed, 11 Apr 2018 14:09:54 +0200 Subject: [PATCH] Fix timezone where somtimes apache / php timezone differ from container timezone --- docker-compose-test.yml | 6 +++--- glpi-start.sh | 4 ++++ timezone.ini | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/docker-compose-test.yml b/docker-compose-test.yml index a031812..2d7d474 100644 --- a/docker-compose-test.yml +++ b/docker-compose-test.yml @@ -12,10 +12,10 @@ services: - mysql:mysql restart: always volumes: - - "./timezone.ini:/etc/php/7.0/cli/php.ini" - - "./timezone.ini:/etc/php/7.0/apache2/php.ini" - "/etc/timezone:/etc/timezone" - "/etc/localtime:/etc/localtime" + environment: + TIMEZONE: Europe/Paris #Mysql Container mysql: @@ -23,4 +23,4 @@ services: container_name: mysql hostname: mysql env_file: - - ./mysql.env \ No newline at end of file + - ./mysql.env diff --git a/glpi-start.sh b/glpi-start.sh index e293c49..7b9150e 100644 --- a/glpi-start.sh +++ b/glpi-start.sh @@ -4,6 +4,10 @@ [[ ! "$VERSION_GLPI" ]] \ && VERSION_GLPI=$(curl -s https://api.github.com/repos/glpi-project/glpi/releases/latest | grep tag_name | cut -d '"' -f 4) +if [[ -z "${TIMEZONE}" ]]; then echo "TIMEZONE is unset"; +else echo "date.timezone = \"$TIMEZONE\"" > /etc/php/7.0/apache2/conf.d/timezone.ini; +fi + SRC_GLPI="https://github.com/glpi-project/glpi/releases/download/${VERSION_GLPI}/glpi-${VERSION_GLPI}.tgz" TAR_GLPI=glpi-${VERSION_GLPI}.tgz FOLDER_GLPI=glpi/ diff --git a/timezone.ini b/timezone.ini index 36e4ffc..abe8f0b 100644 --- a/timezone.ini +++ b/timezone.ini @@ -1 +1 @@ -Europe/Paris \ No newline at end of file +date.timezone = "Europe/Paris"