forked from tvelocity/dockerfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial experimental Dockerfile for Syncthing
- Loading branch information
Showing
2 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
FROM debian:jessie | ||
|
||
ENV SYNCTHING_VERSION 0.10.30 | ||
|
||
RUN apt-get update && apt-get install -y ca-certificates --no-install-recommends && rm -rf /var/lib/apt/lists/* | ||
|
||
# gpg: key 00654A3E: public key "Syncthing Release Management <[email protected]>" imported | ||
RUN gpg --keyserver pool.sks-keyservers.net --recv-keys 37C84554E7E0A261E4F76E1ED26E6ED000654A3E | ||
|
||
RUN set -x \ | ||
&& apt-get update \ | ||
&& apt-get install -y curl xmlstarlet --no-install-recommends \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& tarball="syncthing-linux-amd64-v${SYNCTHING_VERSION}.tar.gz" \ | ||
&& curl -SL "https://github.com/syncthing/syncthing/releases/download/v${SYNCTHING_VERSION}/"{"$tarball",sha1sum.txt.asc} -O \ | ||
&& apt-get purge -y --auto-remove curl \ | ||
&& gpg --verify sha1sum.txt.asc \ | ||
&& grep -E " ${tarball}\$" sha1sum.txt.asc | sha1sum -c - \ | ||
&& rm sha1sum.txt.asc \ | ||
&& tar -xvf "$tarball" --strip-components=1 "$(basename "$tarball" .tar.gz)"/syncthing \ | ||
&& mv syncthing /usr/local/bin/syncthing \ | ||
&& rm "$tarball" | ||
|
||
EXPOSE 8080 22000 21025/udp | ||
|
||
ADD entrypoint.sh /entrypoint.sh | ||
|
||
RUN useradd -m syncthing | ||
VOLUME /home/syncthing | ||
WORKDIR /home/syncthing | ||
|
||
ENTRYPOINT ["/entrypoint.sh"] | ||
CMD ["syncthing"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
HOME=`eval echo ~syncthing` | ||
CONFIG_FOLDER="$HOME/.config/syncthing" | ||
CONFIG_FILE="$CONFIG_FOLDER/config.xml" | ||
|
||
if [ ! -f "$CONFIG_FILE" ]; then | ||
syncthing -generate="$CONFIG_FOLDER" | ||
xmlstarlet ed -L -u "/configuration/gui/address" -v "0.0.0.0:8080" "$CONFIG_FILE" | ||
fi | ||
|
||
chown -R syncthing:syncthing "$HOME" | ||
|
||
exec su - syncthing -c syncthing |