From 7aeaf7738e264cc041ae30705a27fc1e8c621b47 Mon Sep 17 00:00:00 2001 From: tobbenb Date: Sun, 13 Nov 2016 21:23:37 +0100 Subject: [PATCH 1/2] remove cpanm cache in /root folder --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index b5464c9..7a9f0e9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -53,6 +53,7 @@ RUN \ build-dependencies && \ rm -rf \ /config/.cpanm \ + /root/.cpanm \ /tmp/* # copy local files From b4f7ff93d8c524195169b5adcd52f3d5c505aaec Mon Sep 17 00:00:00 2001 From: tobbenb Date: Sun, 13 Nov 2016 23:26:35 +0100 Subject: [PATCH 2/2] Fix permission jabber from ddclient and changed method to restart ddclient --- Dockerfile | 9 ++++++--- root/defaults/ddclient.conf | 4 ++-- root/etc/cont-init.d/30-config | 1 - root/etc/services.d/ddclient/run | 2 +- root/etc/services.d/inotify_modify/run | 6 ++++-- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7a9f0e9..ca8a936 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,6 +6,9 @@ ARG BUILD_DATE ARG VERSION LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}" +# copy local files +COPY root/ / + # install build time dependencies RUN \ apk add --no-cache --virtual=build-dependencies \ @@ -39,6 +42,9 @@ RUN \ tar xf /tmp/ddclient.tar.bz2 -C \ /tmp/ddclient --strip-components=1 && \ cp /tmp/ddclient/ddclient /usr/bin/ && \ + cp /defaults/ddclient.conf /ddclient.conf && \ + chmod 600 /ddclient.conf && \ + chown ddclient:ddclient /ddclient.conf && \ # add runtime folders and change permissions mkdir -p /var/cache/ddclient && \ @@ -55,9 +61,6 @@ RUN \ /config/.cpanm \ /root/.cpanm \ /tmp/* - -# copy local files -COPY root/ / # ports and volumes VOLUME /config diff --git a/root/defaults/ddclient.conf b/root/defaults/ddclient.conf index a1f9d2c..c21ba40 100644 --- a/root/defaults/ddclient.conf +++ b/root/defaults/ddclient.conf @@ -20,8 +20,8 @@ ###################################################################### daemon=300 # check every 300 seconds syslog=yes # log update msgs to syslog -mail=root # mail all msgs to root -mail-failure=root # mail failed update msgs to root +#mail=root # mail all msgs to root +#mail-failure=root # mail failed update msgs to root pid=/var/run/ddclient/ddclient.pid # record PID in file. ssl=yes # use ssl-support. Works with # ssl-library diff --git a/root/etc/cont-init.d/30-config b/root/etc/cont-init.d/30-config index 18301bc..bec97ed 100644 --- a/root/etc/cont-init.d/30-config +++ b/root/etc/cont-init.d/30-config @@ -1,6 +1,5 @@ #!/usr/bin/with-contenv bash - # copy default config if not present in /config [[ ! -e /config/ddclient.conf ]] && \ cp /defaults/ddclient.conf /config diff --git a/root/etc/services.d/ddclient/run b/root/etc/services.d/ddclient/run index 6ce5843..94eb9df 100644 --- a/root/etc/services.d/ddclient/run +++ b/root/etc/services.d/ddclient/run @@ -1,3 +1,3 @@ #!/usr/bin/with-contenv bash exec \ - s6-setuidgid ddclient /usr/bin/ddclient -foreground -file /config/ddclient.conf \ No newline at end of file + s6-setuidgid ddclient /usr/bin/ddclient -foreground -file /ddclient.conf \ No newline at end of file diff --git a/root/etc/services.d/inotify_modify/run b/root/etc/services.d/inotify_modify/run index 18b3de0..2f0d6e0 100644 --- a/root/etc/services.d/inotify_modify/run +++ b/root/etc/services.d/inotify_modify/run @@ -1,8 +1,10 @@ #!/usr/bin/with-contenv bash # starting inotify to watch /config/ddclient.conf and restart ddclient if changed. -while inotifywait -e modify /config/ddclient.conf; do -# kill "$(pgrep ddclient)" +while inotifywait -e close_write /config/ddclient.conf; do + cp /config/ddclient.conf /ddclient.conf + chmod 600 /ddclient.conf + chown ddclient:ddclient /ddclient.conf kill "$(cat /var/run/ddclient/ddclient.pid)" echo "ddclient have been restarted" done \ No newline at end of file