From 5200155770e125f234af8a6af89d745611ede2dc Mon Sep 17 00:00:00 2001 From: Mark Date: Sat, 1 Oct 2022 17:31:31 -0700 Subject: [PATCH] Added syncthing files --- syncthing/Dockerfile | 26 ++++++++++++++++++++++++++ syncthing/docker-compose.yml | 15 +++++++++++++++ syncthing/start.sh | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 77 insertions(+) create mode 100644 syncthing/Dockerfile create mode 100644 syncthing/docker-compose.yml create mode 100644 syncthing/start.sh diff --git a/syncthing/Dockerfile b/syncthing/Dockerfile new file mode 100644 index 0000000..70982aa --- /dev/null +++ b/syncthing/Dockerfile @@ -0,0 +1,26 @@ +FROM archlinux +LABEL maintiner="Mark " + +# Create users and groups. +# Make sure uids and gids are the same on the host! +# +# Syncthing should be installed AFTER users are created. +# The package will create its own syncthing user if one does not exist. +# We need to do it manually, to control uid and gid. + +RUN groupadd -g 1000 syncthing && \ + useradd -g 1000 -u 1000 syncthing -d /stdata && \ + pacman -Fyy --noconfirm && \ + pacman -Syu --noconfirm && \ + pacman -S --noconfirm syncthing syncthing-relaysrv + +VOLUME /syncthing + +# Syncthing +EXPOSE 8384 + +# Relay +EXPOSE 22067 + +COPY start.sh /start.sh +ENTRYPOINT ["/bin/bash", "start.sh"] diff --git a/syncthing/docker-compose.yml b/syncthing/docker-compose.yml new file mode 100644 index 0000000..72b350d --- /dev/null +++ b/syncthing/docker-compose.yml @@ -0,0 +1,15 @@ +version: "2" + +services: + syncserver: + build: ./build + container_name: syncthing + restart: unless-stopped + + volumes: + - "./stdata:/stdata" + - "./stconfig:/stconfig" + # host:container + ports: + - "8384:8384" + - "22067:22067" \ No newline at end of file diff --git a/syncthing/start.sh b/syncthing/start.sh new file mode 100644 index 0000000..bb7a8f8 --- /dev/null +++ b/syncthing/start.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +# Files go here +mkdir /stdata + + + +# Configs go here +mkdir /stconfig +mkdir /stconfig/config + +chown -R syncthing:syncthing /stdata +chmod -R 774 /stdata + +chown -R syncthing:syncthing /stconfig +chmod -R 774 /stconfig + +su - syncthing -c ' +cd /stconfig +syncthing-relaysrv \ + -pools="" \ + -keys="/stconfig" \ + -listen=":22067" \ + -ping-interval="30s" \ + -protocol="tcp4" \ + -provided-by="Betalupi" \ + -status-srv=""' & + +su - syncthing -c ' +syncthing \ + -gui-address=0.0.0.0:8384 \ + -home="/stconfig/config" \ + --no-browser +' + +