From b6dc7cb73bc2dfa6406345292ba902eee5bc28be Mon Sep 17 00:00:00 2001 From: David Lantos Date: Thu, 8 Apr 2021 15:41:28 +0100 Subject: [PATCH 1/2] Verify that we are installing an existing timezone We are currently running the application on UTC timezone because there isn't any `/etc/localtime` file on the server This change adds a (currently failing) build-time check for existence of the timezone file we are trying to use --- Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 3fd245580..54cdea83b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,9 @@ FROM node:14-alpine3.13 as base LABEL maintainer="HMPPS Digital Studio " ENV TZ=Europe/London -RUN ln -snf "/usr/share/zoneinfo/$TZ" /etc/localtime && echo "$TZ" > /etc/timezone +RUN test -e "/usr/share/zoneinfo/$TZ" && \ + ln -snf "/usr/share/zoneinfo/$TZ" /etc/localtime && \ + echo "$TZ" > /etc/timezone RUN addgroup --gid 2000 --system appgroup && \ adduser --uid 2000 --system appuser && \ From 774f922cd95a3df615862f142b6e47900a6a8adc Mon Sep 17 00:00:00 2001 From: David Lantos Date: Thu, 8 Apr 2021 15:45:03 +0100 Subject: [PATCH 2/2] Make sure we have Europe/London timezone available Fixes the build check introduced in the previous commit --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 54cdea83b..44dca8e88 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,8 @@ FROM node:14-alpine3.13 as base LABEL maintainer="HMPPS Digital Studio " ENV TZ=Europe/London -RUN test -e "/usr/share/zoneinfo/$TZ" && \ +RUN apk add --no-cache tzdata && \ + test -e "/usr/share/zoneinfo/$TZ" && \ ln -snf "/usr/share/zoneinfo/$TZ" /etc/localtime && \ echo "$TZ" > /etc/timezone