Skip to content

Commit

Permalink
Hotfix/php timezone (maxpou#67)
Browse files Browse the repository at this point in the history
* One line symlink to localtime

* Make timezone variable and set /etc/timezone too

* Set PHP timezone

* Take the timezone configuration out to the env file
  • Loading branch information
carlosas authored and maxpou committed Sep 10, 2017
1 parent a9dff03 commit 3ddfac8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .env.dist
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ MYSQL_ROOT_PASSWORD=root
MYSQL_DATABASE=mydb
MYSQL_USER=user
MYSQL_PASSWORD=userpass

# Timezone
TIMEZONE=Europe/Paris
5 changes: 4 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ services:
MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
php:
build: php7-fpm
build:
context: php7-fpm
args:
TIMEZONE: ${TIMEZONE}
volumes:
- ${SYMFONY_APP_PATH}:/var/www/symfony
- ./logs/symfony:/var/www/symfony/app/logs
Expand Down
5 changes: 3 additions & 2 deletions php7-fpm/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# See https://github.com/docker-library/php/blob/4677ca134fe48d20c820a19becb99198824d78e3/7.0/fpm/Dockerfile
FROM php:7.0-fpm
ARG TIMEZONE

MAINTAINER Maxence POUTORD <[email protected]>

Expand All @@ -12,8 +13,8 @@ RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local
RUN composer --version

# Set timezone
RUN rm /etc/localtime
RUN ln -s /usr/share/zoneinfo/Europe/Paris /etc/localtime
RUN ln -snf /usr/share/zoneinfo/${TIMEZONE} /etc/localtime && echo ${TIMEZONE} > /etc/timezone
RUN printf '[PHP]\ndate.timezone = "%s"\n', ${TIMEZONE} > /usr/local/etc/php/conf.d/tzone.ini
RUN "date"

# Type docker-php-ext-install to see available extensions
Expand Down

0 comments on commit 3ddfac8

Please sign in to comment.