mirror of
https://github.com/linuxserver/docker-ddclient.git
synced 2026-02-20 03:15:49 +08:00
Merge pull request #4 from linuxserver/abc-rewrite
rewrite using abc user
This commit is contained in:
commit
cf01799840
33
Dockerfile
33
Dockerfile
@ -6,8 +6,8 @@ ARG BUILD_DATE
|
||||
ARG VERSION
|
||||
LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}"
|
||||
|
||||
# copy local files
|
||||
COPY root/ /
|
||||
# package versions
|
||||
ARG DDCLIENT_VER="3.8.3"
|
||||
|
||||
# install build time dependencies
|
||||
RUN \
|
||||
@ -31,28 +31,16 @@ RUN \
|
||||
curl -L http://cpanmin.us | perl - App::cpanminus && \
|
||||
cpanm JSON::Any && \
|
||||
|
||||
# create ddclient user for running ddclient so it doesn't modify permissions of the config file
|
||||
useradd -u 931 -U -s /bin/false ddclient && \
|
||||
|
||||
# install ddclient
|
||||
mkdir -p /tmp/ddclient && \
|
||||
mkdir -p \
|
||||
/tmp/ddclient && \
|
||||
curl -o \
|
||||
/tmp/ddclient.tar.bz2 -L \
|
||||
http://vorboss.dl.sourceforge.net/project/ddclient/ddclient/ddclient-3.8.3/ddclient-3.8.3.tar.bz2 && \
|
||||
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 && \
|
||||
chown ddclient:ddclient /var/cache/ddclient && \
|
||||
mkdir -p /var/run/ddclient && \
|
||||
chown ddclient:ddclient /var/run/ddclient && \
|
||||
|
||||
|
||||
"http://vorboss.dl.sourceforge.net/project/ddclient/ddclient/ddclient-${DDCLIENT_VER}/ddclient-${DDCLIENT_VER}.tar.bz2" && \
|
||||
tar xf \
|
||||
/tmp/ddclient.tar.bz2 -C \
|
||||
/tmp/ddclient --strip-components=1 && \
|
||||
install -Dm755 /tmp/ddclient/ddclient /usr/bin/ && \
|
||||
|
||||
# cleanup
|
||||
apk del --purge \
|
||||
@ -62,5 +50,8 @@ RUN \
|
||||
/root/.cpanm \
|
||||
/tmp/*
|
||||
|
||||
# copy local files
|
||||
COPY root/ /
|
||||
|
||||
# ports and volumes
|
||||
VOLUME /config
|
||||
|
||||
@ -1,15 +1,25 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
|
||||
# copy config from /config to root
|
||||
[[ -e /config/ddclient.conf ]] && \
|
||||
cp /config/ddclient.conf /ddclient.conf
|
||||
# make our folders
|
||||
mkdir -p \
|
||||
/var/cache/ddclient \
|
||||
/var/run/ddclient
|
||||
|
||||
# copy default config if not present in /config
|
||||
[[ ! -e /config/ddclient.conf ]] && \
|
||||
cp /defaults/ddclient.conf /config
|
||||
|
||||
# copy config from /config to root
|
||||
cp /config/ddclient.conf /ddclient.conf
|
||||
|
||||
# permissions
|
||||
chown abc:abc \
|
||||
/ddclient.conf
|
||||
chmod 600 \
|
||||
/ddclient.conf
|
||||
chown -R abc:abc \
|
||||
/config
|
||||
/config \
|
||||
/var/cache/ddclient \
|
||||
/var/run/ddclient
|
||||
chmod -R 765 \
|
||||
/config
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
exec \
|
||||
s6-setuidgid ddclient /usr/bin/ddclient -foreground -file /ddclient.conf
|
||||
s6-setuidgid abc /usr/bin/ddclient -foreground -file /ddclient.conf
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
|
||||
# starting inotify to watch /config/ddclient.conf and restart ddclient if changed.
|
||||
while inotifywait -e close_write /config/ddclient.conf; do
|
||||
while inotifywait -e modify /config/ddclient.conf; do
|
||||
cp /config/ddclient.conf /ddclient.conf
|
||||
chown abc:abc /ddclient.conf
|
||||
chmod 600 /ddclient.conf
|
||||
chown ddclient:ddclient /ddclient.conf
|
||||
kill "$(cat /var/run/ddclient/ddclient.pid)"
|
||||
echo "ddclient have been restarted"
|
||||
done
|
||||
s6-svc -h /var/run/s6/services/ddclient
|
||||
echo "ddclient has been restarted"
|
||||
done
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user