diff --git a/Dockerfile b/Dockerfile index 34e3ef2..41f6190 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,17 +6,62 @@ ARG BUILD_DATE ARG VERSION LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}" -# environment settings +# environment settings ENV HOME="/config" -# install packages -RUN \ - apk add --no-cache \ - --repository http://nl.alpinelinux.org/alpine/edge/community \ - syncthing \ - syncthing-utils +# set build and source folders +ARG SYNC_SRC="/tmp/syncthing" +ARG SYNC_BUILD="$SYNC_SRC/src/github.com/syncthing" -# add local files +# install build packages +RUN \ + apk add --no-cache --virtual=build-dependencies \ + curl \ + g++ \ + gcc \ + tar && \ + apk add --no-cache --virtual=build-dependencies2 \ + --repository http://nl.alpinelinux.org/alpine/edge/community \ + go && \ + +# compile syncthing + SYNC_TAG=$(curl -sX GET "https://api.github.com/repos/syncthing/syncthing/releases/latest" \ + | awk '/tag_name/{print $4;exit}' FS='[""]') && \ + mkdir -p \ + "${SYNC_BUILD}" \ + "${SYNC_SRC}" && \ + curl -o \ + /tmp/syncthing.tar.gz -L \ + "https://github.com/syncthing/syncthing/archive/${SYNC_TAG}.tar.gz" && \ + tar xf \ + /tmp/syncthing.tar.gz -C \ + "${SYNC_SRC}" --strip-components=1 && \ + ln -s "$SYNC_SRC" "$SYNC_BUILD/syncthing" && \ + cd "$SYNC_BUILD"/syncthing && \ + export GOPATH="${SYNC_SRC}" && \ + go run build.go -no-upgrade -version=${SYNC_TAG} && \ + +# install syncthing + install -d -o abc -g abc \ + /var/lib/syncthing && \ + install -D -m755 \ + $SYNC_BUILD/syncthing/bin/syncthing \ + /usr/bin/syncthing && \ + for i in $(ls $SYNC_BUILD/syncthing/bin); \ + do if ! [ "$i" = "syncthing" ]; \ + then install -Dm 755 $SYNC_BUILD/syncthing/bin/$i /usr/bin/$i ; \ + fi; \ + done && \ + export GOPATH="" && \ + +# cleanup + apk del --purge \ + build-dependencies \ + build-dependencies2 && \ + rm -rf \ + /tmp/* + +# add local files COPY root/ / # ports and volumes diff --git a/README.md b/README.md index 838ecb1..ef43740 100644 --- a/README.md +++ b/README.md @@ -83,6 +83,7 @@ You can find some of the best documentation available on the web at [docs.syncth ## Versions ++ **01.11.16:** Switch to compiling latest version from git source. + **14.10.16:** Add version layer information. + **30.09.16:** Fix umask. + **09.09.16:** Add layer badges to README.