Added timezone arguments to workspace build

This commit is contained in:
philtrep 2016-10-10 09:44:25 -04:00
parent 781f5ff972
commit fb26035e5c
3 changed files with 30 additions and 0 deletions

View File

@ -61,6 +61,7 @@ It's like Laravel Homestead but for Docker instead of Vagrant.
- [Prepare LaraDock for Production](#LaraDock-for-Production) - [Prepare LaraDock for Production](#LaraDock-for-Production)
- [Setup Laravel and Docker on Digital Ocean](#Digital-Ocean) - [Setup Laravel and Docker on Digital Ocean](#Digital-Ocean)
- [Misc](#Misc) - [Misc](#Misc)
- [Change the timezone](#Change-the-timezone)
- [Cron jobs](#CronJobs) - [Cron jobs](#CronJobs)
- [MySQL access from host](#MySQL-access-from-host) - [MySQL access from host](#MySQL-access-from-host)
- [Use custom Domain](#Use-custom-Domain) - [Use custom Domain](#Use-custom-Domain)
@ -985,6 +986,24 @@ To learn more about how Docker publishes ports, please read [this excellent post
<br> <br>
<a name="Change-the-timezone"></a>
### Change the timezone
To change the timezone for the `workspace` container, modify the `TZ` build argument in the Docker Compose file to one in the [TZ database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
For example, if I want the timezone to be `New York`:
```yml
workspace:
build:
context: ./workspace
args:
- TZ=America/New_York
...
```
We also recommend [setting the timezone in Laravel](http://www.camroncade.com/managing-timezones-with-laravel/).
<a name="CronJobs"></a> <a name="CronJobs"></a>
### Adding cron jobs ### Adding cron jobs
@ -997,6 +1016,8 @@ You can add your cron jobs to `workspace/crontab/root` after the `php artisan` l
* * * * * root echo "Every Minute" > /var/log/cron.log 2>&1 * * * * * root echo "Every Minute" > /var/log/cron.log 2>&1
``` ```
Make sure you [change the timezone](#Change-the-timezone) if you don't want to use the default (UTC).
<a name="MySQL-access-from-host"></a> <a name="MySQL-access-from-host"></a>
### MySQL access from host ### MySQL access from host

View File

@ -18,6 +18,7 @@ services:
- PUID=1000 - PUID=1000
- PGID=1000 - PGID=1000
- NODE_VERSION=stable - NODE_VERSION=stable
- TZ=UTC
volumes_from: volumes_from:
- volumes_source - volumes_source
extra_hosts: extra_hosts:

View File

@ -47,6 +47,14 @@ ARG PGID=1000
RUN groupadd -g $PGID laradock && \ RUN groupadd -g $PGID laradock && \
useradd -u $PUID -g laradock -m laradock useradd -u $PUID -g laradock -m laradock
#####################################
# Set Timezone
#####################################
ARG TZ=UTC
ENV TZ ${TZ}
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
##################################### #####################################
# Composer: # Composer:
##################################### #####################################