diff --git a/syncthing/build/Dockerfile b/syncthing/build/Dockerfile index 70982aa..5a6b3c6 100644 --- a/syncthing/build/Dockerfile +++ b/syncthing/build/Dockerfile @@ -8,19 +8,33 @@ LABEL maintiner="Mark " # 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 && \ +ARG ST_GID="1000" +ARG ST_UID="1000" + +RUN groupadd -g ${ST_GID} syncthing && \ + useradd -g ${ST_GID} -u ${ST_UID} syncthing -d /stdata && \ pacman -Fyy --noconfirm && \ pacman -Syu --noconfirm && \ pacman -S --noconfirm syncthing syncthing-relaysrv -VOLUME /syncthing +RUN mkdir /stdata && \ + mkdir /stconfig && \ + mkdir /stconfig/config && \ + chown -R syncthing:syncthing /stdata && \ + chmod -R 774 /stdata && \ + chown -R syncthing:syncthing /stconfig && \ + chmod -R 774 /stconfig +VOLUME /stdata +VOLUME /stconfig + # Syncthing EXPOSE 8384 - # Relay EXPOSE 22067 -COPY start.sh /start.sh + +USER ${ST_UID} +WORKDIR "/stdata" + ENTRYPOINT ["/bin/bash", "start.sh"] diff --git a/syncthing/build/start.sh b/syncthing/build/start.sh index bb7a8f8..a615347 100644 --- a/syncthing/build/start.sh +++ b/syncthing/build/start.sh @@ -1,22 +1,5 @@ #!/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" \ @@ -24,13 +7,11 @@ syncthing-relaysrv \ -ping-interval="30s" \ -protocol="tcp4" \ -provided-by="Betalupi" \ - -status-srv=""' & + -status-srv="" & -su - syncthing -c ' syncthing \ -gui-address=0.0.0.0:8384 \ -home="/stconfig/config" \ --no-browser -'