Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Set timezone to Europe/London (successfully, this time) #229

Merged
merged 2 commits into from
Apr 15, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ FROM node:14-alpine3.13 as base
LABEL maintainer="HMPPS Digital Studio <[email protected]>"

ENV TZ=Europe/London
RUN ln -snf "/usr/share/zoneinfo/$TZ" /etc/localtime && echo "$TZ" > /etc/timezone
RUN apk add --no-cache tzdata && \
test -e "/usr/share/zoneinfo/$TZ" && \
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of this line, we could also add a "docker build test" that would test the timezone by running the date command:

$ docker run --rm -ti <built_tag> date | egrep "(GMT|BST)"
Thu Apr  8 15:55:29 BST 2021
# exit status 0

vs

$ k exec -ti hmpps-interventions-ui-5fc67cffcd-z4kgx -- date | egrep "(GMT|BST)"
# exit status 1, thus failing the build

However, this isn't trivial to chain after the docker build, before the push at the moment

ln -snf "/usr/share/zoneinfo/$TZ" /etc/localtime && \
echo "$TZ" > /etc/timezone

RUN addgroup --gid 2000 --system appgroup && \
adduser --uid 2000 --system appuser && \
Expand Down