syncthing

This commit is contained in:
f 2019-09-10 22:32:07 -03:00
parent a2e27c5316
commit 6c766bcfef
No known key found for this signature in database
GPG key ID: 2AE5A13E321F953D
4 changed files with 47 additions and 1 deletions

View file

@ -1,2 +1,36 @@
FROM sutty/monit:latest
FROM sutty/daemonize:latest AS build
MAINTAINER "f <f@sutty.nl>"
ARG VERSION=1.2.2
RUN wget https://github.com/syncthing/syncthing/releases/download/v${VERSION}/syncthing-linux-amd64-v${VERSION}.tar.gz
RUN tar x -Of syncthing-linux-amd64-v${VERSION}.tar.gz syncthing-linux-amd64-v${VERSION}/syncthing \
> /usr/local/bin/syncthing
RUN chmod +x /usr/local/bin/syncthing
RUN strip --strip-all /usr/local/bin/syncthing
COPY ./syncthing_stop.sh /usr/local/bin/syncthing_stop
COPY ./syncthing_start.sh /usr/local/bin/syncthing_start
RUN chmod 755 /usr/local/bin/syncthing_stop /usr/local/bin/syncthing_start
RUN echo /home/builder/packages/home > /etc/apk/repositories
RUN apk add --no-cache daemonize
FROM sutty/monit:latest
COPY --from=build /usr/local/bin/syncthing /usr/local/bin/syncthing
COPY --from=build /usr/local/bin/syncthing_stop /usr/local/bin/syncthing_stop
COPY --from=build /usr/local/bin/syncthing_start /usr/local/bin/syncthing_start
COPY --from=build /usr/sbin/daemonize /usr/sbin/daemonize
COPY ./monit.conf /etc/monit.d/syncthing.conf
RUN addgroup -S syncthing
RUN adduser -s /bin/sh -G syncthing -S -h /home/syncthing syncthing
RUN monit -t
RUN apk add --no-cache ca-certificates
EXPOSE 22000
EXPOSE 22000/udp
VOLUME /home/syncthing

3
monit.conf Normal file
View file

@ -0,0 +1,3 @@
check process syncthing with pidfile /tmp/syncthing.pid
start program = "/usr/local/bin/syncthing_start" as uid "syncthing"
stop program = "/usr/local/bin/syncthing_stop"

6
syncthing_start.sh Normal file
View file

@ -0,0 +1,6 @@
#!/bin/sh
daemonize -p /tmp/syncthing.pid -l /tmp/syncthing.pid \
/usr/local/bin/syncthing -no-browser \
-logfile="/home/syncthing/syncthing.log" \
-gui-address="http://0.0.0.0:8443"

3
syncthing_stop.sh Normal file
View file

@ -0,0 +1,3 @@
#!/bin/sh
ps aux | grep syncthing | tr -s " " | cut -d " " -f 2 | xargs kill