diff --git a/Dockerfile b/Dockerfile index c4dd59b..b6ee221 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,7 +11,7 @@ RUN apk --no-cache add \ # Install backuppc build dependencies gcc g++ autoconf automake make git patch perl perl-dev perl-cgi expat expat-dev curl wget \ # Install backuppc runtime dependencies -supervisor rsync samba-client iputils openssh openssl rrdtool msmtp lighttpd lighttpd-mod_auth gzip apache2-utils \ +supervisor rsync samba-client iputils openssh openssl rrdtool msmtp lighttpd lighttpd-mod_auth gzip apache2-utils tzdata \ # Compile and install needed perl modules && cpan App::cpanminus \ && cpanm -n Archive::Zip XML::RSS File::Listing \ diff --git a/README.md b/README.md index d08fc39..417ee8a 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,9 @@ * [Advanced SMTP configuration](#advanced-smtp-configuration) * [Upgrading](#upgrading) * [Dockerising an existing BackupPC v3.x](#dockerising-an-existing-backuppc-v3x) -* [Shell access](#shell-access) +* [Miscellaneous](#miscellaneous) + * [Timezone](#timezone) + * [Shell access](#shell-access) ## Introduction @@ -222,6 +224,32 @@ docker run \ The configure.pl script will detect a v3.x version under /etc/backuppc, and will run appropriate upgrade operations (in particular enabling legacy v3.x pool to access it from a BackupPC v4.x). +## Miscellaneous + +### Timezone + +By default the timezone of this docker is set to UTC. To modify it, you can specify a tzdata-compatible timezone in the environment variable `TZ`. + +```bash +# For Paris time (including daylight) +docker run \ + --name backuppc \ + --publish 80:8080 \ + --env TZ=Europe/Paris \ + adferrand/backuppc +``` + +Alternatively, you can sync the container timezone to its host by mounting the host file `/etc/localtime` to the container path `/etc/localtime`. + +```bash +# For Paris time (including daylight) +docker run \ + --name backuppc \ + --publish 80:8080 \ + --mount /etc/localtime:/etc/localtime:ro \ + adferrand/backuppc +``` + ## Shell access For debugging and maintenance purpose, you may need to start a shell in your running container. With a Docker of version 1.3.0 or higher, you can do: diff --git a/VERSION b/VERSION index 6bc15c4..d8c3741 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -4.1.3-5 +4.1.3-6 diff --git a/files/entrypoint.sh b/files/entrypoint.sh index 7f314cf..6f813ad 100755 --- a/files/entrypoint.sh +++ b/files/entrypoint.sh @@ -5,6 +5,11 @@ if [ -f /firstrun ]; then echo 'First run of the container. BackupPC will be installed.' echo 'If exist, configuration and data will be reused and upgraded as needed.' + # Configure timezone if needed + if [ -z "$TZ" ]; then + cp /usr/share/zoneinfo/$TZ /etc/localtime + fi + # Create backuppc user addgroup -S -g ${BACKUPPC_GUID:-1000} backuppc adduser -D -S -h /home/backuppc -G backuppc -u ${BACKUPPC_UUID:-1000} backuppc