commit 0f1b676

daltux  ·  2025-09-04 18:25:24 +0000 UTC
parent 36d7bea
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.
2 files changed,  +8, -3
+2, -1
 1@@ -9,8 +9,9 @@ RUN apk -U --no-progress --no-cache add curl-dev build-base && \
 2   cp examples/docker-entrypoint.sh /build/out/usr/local/bin/entrypoint.sh
 3 
 4 FROM alpine:${ALPINE_VERSION}
 5-RUN apk -U --no-progress --no-cache add libcurl
 6+RUN apk -U --no-progress --no-cache add libcurl tzdata
 7 COPY --from=builder /build/out /
 8 EXPOSE 5050
 9 VOLUME [ "/data" ]
10 ENTRYPOINT [ "/usr/local/bin/entrypoint.sh" ]
11+
+6, -2
 1@@ -1,7 +1,11 @@
 2 #! /bin/sh
 3-if [ ! -e /data/data/server.json ]
 4-then
 5+if [ -n "$TZ" ] ; then
 6+	ln -snf "/usr/share/zoneinfo/$TZ" /etc/localtime \
 7+		&& echo "$TZ" > /etc/timezone
 8+fi
 9+if [ ! -e /data/data/server.json ] ; then
10     echo -ne "0.0.0.0\r\n8001\r\nlocalhost\r\n\r\n\r\n" | snac init /data/data
11     snac adduser /data/data testuser
12 fi
13 SSLKEYLOGFILE=/data/key snac httpd /data/data
14+