Explorar o código

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.
daltux hai 10 meses
pai
achega
0f1b676113
Modificáronse 2 ficheiros con 8 adicións e 3 borrados
  1. 2 1
      Dockerfile
  2. 6 2
      examples/docker-entrypoint.sh

+ 2 - 1
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" ]
+

+ 6 - 2
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
+