From 125460345fe4bd0ed9be48a9fbc0657019637a01 Mon Sep 17 00:00:00 2001 From: djay Date: Thu, 25 Feb 2016 21:56:33 +0100 Subject: [PATCH 1/3] Add the timezone for PHP docker container --- docker/php/Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker/php/Dockerfile b/docker/php/Dockerfile index 7c56ae573..c230bc445 100644 --- a/docker/php/Dockerfile +++ b/docker/php/Dockerfile @@ -5,6 +5,8 @@ RUN apt-get update && apt-get install -y \ && docker-php-ext-install \ iconv mcrypt mbstring intl pdo pdo_mysql pdo_pgsql +RUN echo "date.timezone=Europe/Paris" > /usr/local/etc/php/conf.d/date_timezone.ini + RUN usermod -u 1000 www-data CMD ["php-fpm"] From 612f5f1ec7eeaeacb1f1bc0f2e15fbe5ff7d7044 Mon Sep 17 00:00:00 2001 From: djay Date: Wed, 2 Mar 2016 13:31:53 +0100 Subject: [PATCH 2/3] Add the timezone as an argument in the docker-compose. For that, need to use v2 of docker-compose (with version >= 1.6.0) --- docker-compose.yml | 89 +++++++++++++++++++++++-------------------- docker/php/Dockerfile | 4 +- 2 files changed, 50 insertions(+), 43 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index c774b6217..26fba8f0a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,42 +1,47 @@ -nginx: - image: nginx - ports: - - "8080:80" - volumes: - - ./docker/nginx/nginx.conf:/nginx.conf - - ./docker/logs/nginx:/var/log/nginx - - .:/var/www/html - links: - - php:php - command: nginx -c /nginx.conf -php: - build: docker/php - ports: - - "9000:9000" - volumes: - - .:/var/www/html - #links: - # - "postgres:rdbms" - # - "mariadb:rdbms" - env_file: - - ./docker/php/env - # Comment non-used DBMS lines - # If all DBMS are commented out, sqlite will be used as default - # - ./docker/postgres/env - # - ./docker/mariadb/env -#postgres: -# image: postgres:9 -# ports: -# - "5432:5432" -# volumes: -# - ./docker/data/pgsql:/var/lib/postgresql/data -# env_file: -# - ./docker/postgres/env -#mariadb: -# image: mariadb:10 -# ports: -# - "3306:3306" -# volumes: -# - ./docker/data/mariadb:/var/lib/mysql -# env_file: -# - ./docker/mariadb/env +version: '2' +services: + nginx: + image: nginx + ports: + - "8080:80" + volumes: + - ./docker/nginx/nginx.conf:/nginx.conf + - ./docker/logs/nginx:/var/log/nginx + - .:/var/www/html + links: + - php:php + command: nginx -c /nginx.conf + php: + build: + context: docker/php + args: + timezone: 'Europe/Monaco' + ports: + - "9000:9000" + volumes: + - .:/var/www/html + #links: + # - "postgres:rdbms" + # - "mariadb:rdbms" + env_file: + - ./docker/php/env + # Comment non-used DBMS lines + # If all DBMS are commented out, sqlite will be used as default + # - ./docker/postgres/env + # - ./docker/mariadb/env + #postgres: + # image: postgres:9 + # ports: + # - "5432:5432" + # volumes: + # - ./docker/data/pgsql:/var/lib/postgresql/data + # env_file: + # - ./docker/postgres/env + #mariadb: + # image: mariadb:10 + # ports: + # - "3306:3306" + # volumes: + # - ./docker/data/mariadb:/var/lib/mysql + # env_file: + # - ./docker/mariadb/env diff --git a/docker/php/Dockerfile b/docker/php/Dockerfile index c230bc445..b43d40b51 100644 --- a/docker/php/Dockerfile +++ b/docker/php/Dockerfile @@ -1,11 +1,13 @@ FROM php:fpm +ARG timezone='Europe/Paris' + RUN apt-get update && apt-get install -y \ libmcrypt-dev libicu-dev libpq-dev libxml2-dev \ && docker-php-ext-install \ iconv mcrypt mbstring intl pdo pdo_mysql pdo_pgsql -RUN echo "date.timezone=Europe/Paris" > /usr/local/etc/php/conf.d/date_timezone.ini +RUN echo "date.timezone="$timezone > /usr/local/etc/php/conf.d/date_timezone.ini RUN usermod -u 1000 www-data From b80841f23c6736aef7485aa3d8ba7cf0af861f64 Mon Sep 17 00:00:00 2001 From: djay Date: Thu, 3 Mar 2016 19:21:37 +0100 Subject: [PATCH 3/3] Add comment about timezone definition --- docker-compose.yml | 1 + docker/php/Dockerfile | 1 + 2 files changed, 2 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 26fba8f0a..50d8c546e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -15,6 +15,7 @@ services: build: context: docker/php args: + # Set here your timezone using one of this: http://php.net/manual/en/timezones.php timezone: 'Europe/Monaco' ports: - "9000:9000" diff --git a/docker/php/Dockerfile b/docker/php/Dockerfile index b43d40b51..29d27c3a8 100644 --- a/docker/php/Dockerfile +++ b/docker/php/Dockerfile @@ -1,5 +1,6 @@ FROM php:fpm +# Default timezone. To change it, use the argument in the docker-compose.yml file ARG timezone='Europe/Paris' RUN apt-get update && apt-get install -y \