From 0f1b67611317ab7163a134573b525eb10b415ea8 Mon Sep 17 00:00:00 2001 From: daltux Date: Thu, 4 Sep 2025 15:25:24 -0300 Subject: Add tzdata to container image Install Alpine package `tzdata` to the container image. When running it, set timezone from environment variable TZ if not empty. --- Dockerfile | 3 ++- examples/docker-entrypoint.sh | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index e909cfa..3b5aea2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,8 +9,9 @@ RUN apk -U --no-progress --no-cache add curl-dev build-base && \ cp examples/docker-entrypoint.sh /build/out/usr/local/bin/entrypoint.sh FROM alpine:${ALPINE_VERSION} -RUN apk -U --no-progress --no-cache add libcurl +RUN apk -U --no-progress --no-cache add libcurl tzdata COPY --from=builder /build/out / EXPOSE 5050 VOLUME [ "/data" ] ENTRYPOINT [ "/usr/local/bin/entrypoint.sh" ] + diff --git a/examples/docker-entrypoint.sh b/examples/docker-entrypoint.sh index a6216b2..d198bf2 100755 --- a/examples/docker-entrypoint.sh +++ b/examples/docker-entrypoint.sh @@ -1,7 +1,11 @@ #! /bin/sh -if [ ! -e /data/data/server.json ] -then +if [ -n "$TZ" ] ; then + ln -snf "/usr/share/zoneinfo/$TZ" /etc/localtime \ + && echo "$TZ" > /etc/timezone +fi +if [ ! -e /data/data/server.json ] ; then echo -ne "0.0.0.0\r\n8001\r\nlocalhost\r\n\r\n\r\n" | snac init /data/data snac adduser /data/data testuser fi SSLKEYLOGFILE=/data/key snac httpd /data/data + -- cgit v1.2.3