Skip to content

Commit

Permalink
Initial experimental Dockerfile for Syncthing
Browse files Browse the repository at this point in the history
  • Loading branch information
tvelocity committed Apr 21, 2015
1 parent 0be9d7d commit ad87459
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
33 changes: 33 additions & 0 deletions syncthing/Dockerfile
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"]
15 changes: 15 additions & 0 deletions syncthing/entrypoint.sh
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

0 comments on commit ad87459

Please sign in to comment.