From b9cc02831472f5f462a3d4a2bb63e59ddebadf3e Mon Sep 17 00:00:00 2001 From: sparklyballs Date: Tue, 1 Nov 2016 21:39:07 +0000 Subject: [PATCH 1/2] compile syncthing from github source --- Dockerfile | 56 ++++++++++++++++++++++++++++++++++++++++++++++-------- README.md | 1 + 2 files changed, 49 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 34e3ef2..584cc87 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,17 +6,57 @@ 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 \ + go \ + tar && \ + +# 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 && \ + 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. From 52e5c4df0a310fd679bc379e53f8bb1efa4c167f Mon Sep 17 00:00:00 2001 From: sparklyballs Date: Wed, 2 Nov 2016 16:33:34 +0000 Subject: [PATCH 2/2] switch to using go 1.7, smaller end product --- Dockerfile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 584cc87..41f6190 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,8 +17,12 @@ ARG SYNC_BUILD="$SYNC_SRC/src/github.com/syncthing" RUN \ apk add --no-cache --virtual=build-dependencies \ curl \ - go \ + 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" \ @@ -52,7 +56,8 @@ RUN \ # cleanup apk del --purge \ - build-dependencies && \ + build-dependencies \ + build-dependencies2 && \ rm -rf \ /tmp/*