diff mbox series

docker: set timezone to Australia/Canberra

Message ID 20180320223415.26623-1-dja@axtens.net
State Accepted
Headers show
Series docker: set timezone to Australia/Canberra | expand

Commit Message

Daniel Axtens March 20, 2018, 10:34 p.m. UTC
The tzinfo package isn't installed in docker, which makes the
default timezone UTC. This is unfortunate: the Django TZ in
settings/base.py is Australia/Canberra, and having a non-UTC
TZ is good for exposing faulty assumptions about what is and
isn't UTC.

Signed-off-by: Daniel Axtens <dja@axtens.net>
---
 tools/docker/Dockerfile | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Stephen Finucane March 25, 2018, 3:05 p.m. UTC | #1
On Wed, 2018-03-21 at 09:34 +1100, Daniel Axtens wrote:
> The tzinfo package isn't installed in docker, which makes the
> default timezone UTC. This is unfortunate: the Django TZ in
> settings/base.py is Australia/Canberra, and having a non-UTC
> TZ is good for exposing faulty assumptions about what is and
> isn't UTC.
> 
> Signed-off-by: Daniel Axtens <dja@axtens.net>

Reviewed-by: Stephen Finucane <stephen@that.guru>
Daniel Axtens April 5, 2018, 9:47 a.m. UTC | #2
Applied, thanks Stephen.

Daniel Axtens <dja@axtens.net> writes:

> The tzinfo package isn't installed in docker, which makes the
> default timezone UTC. This is unfortunate: the Django TZ in
> settings/base.py is Australia/Canberra, and having a non-UTC
> TZ is good for exposing faulty assumptions about what is and
> isn't UTC.
>
> Signed-off-by: Daniel Axtens <dja@axtens.net>
> ---
>  tools/docker/Dockerfile | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile
> index eb6d35d82528..31b2aaeedf49 100644
> --- a/tools/docker/Dockerfile
> +++ b/tools/docker/Dockerfile
> @@ -1,6 +1,7 @@
>  FROM ubuntu:17.10
>  
>  ARG UID=1000
> +ARG TZ="Australia/Canberra"
>  
>  ENV PROJECT_HOME /home/patchwork/patchwork
>  
> @@ -22,12 +23,15 @@ RUN apt-get update -qq && \
>      python3.5-dev python3-pip python3-setuptools python3-wheel \
>      python3.4-dev findutils=4.4.2-7 python3.6-dev \
>      libmysqlclient-dev mysql-client curl unzip xvfb chromium-chromedriver \
> -    chromium-browser build-essential git postgresql-client && \
> +    chromium-browser build-essential git postgresql-client tzdata && \
>      ln -s /usr/lib/chromium-browser/chromedriver /usr/bin/
>  
>  # User
>  RUN useradd --uid=$UID --create-home patchwork
>  
> +# Timezone
> +RUN rm /etc/localtime; ln -s /usr/share/zoneinfo/$TZ /etc/localtime
> +
>  # Python requirements.
>  # If you update requirements, you should rebuild the container.
>  # entrypoint.sh will prompt you to do this.
> -- 
> 2.14.1
diff mbox series

Patch

diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile
index eb6d35d82528..31b2aaeedf49 100644
--- a/tools/docker/Dockerfile
+++ b/tools/docker/Dockerfile
@@ -1,6 +1,7 @@ 
 FROM ubuntu:17.10
 
 ARG UID=1000
+ARG TZ="Australia/Canberra"
 
 ENV PROJECT_HOME /home/patchwork/patchwork
 
@@ -22,12 +23,15 @@  RUN apt-get update -qq && \
     python3.5-dev python3-pip python3-setuptools python3-wheel \
     python3.4-dev findutils=4.4.2-7 python3.6-dev \
     libmysqlclient-dev mysql-client curl unzip xvfb chromium-chromedriver \
-    chromium-browser build-essential git postgresql-client && \
+    chromium-browser build-essential git postgresql-client tzdata && \
     ln -s /usr/lib/chromium-browser/chromedriver /usr/bin/
 
 # User
 RUN useradd --uid=$UID --create-home patchwork
 
+# Timezone
+RUN rm /etc/localtime; ln -s /usr/share/zoneinfo/$TZ /etc/localtime
+
 # Python requirements.
 # If you update requirements, you should rebuild the container.
 # entrypoint.sh will prompt you to do this.