Skip to content

Commit

Permalink
Merge pull request #23 from linuxserver/pipeline
Browse files Browse the repository at this point in the history
adding pipeline logic and multi arching
  • Loading branch information
aptalca authored Jan 22, 2019
2 parents f00a65b + c9e3e4f commit ce58559
Show file tree
Hide file tree
Showing 7 changed files with 908 additions and 11 deletions.
11 changes: 7 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ FROM lsiobase/alpine:3.7 as buildstage
# runtime stage uses 3.8 alpine

# build variables
ARG SYNCTHING_RELEASE
ARG SYNC_SRC="/tmp/syncthing"
ARG SYNC_BUILD="$SYNC_SRC/src/github.com/syncthing/syncthing"

Expand All @@ -18,20 +19,22 @@ RUN \

RUN \
echo "**** fetch source code ****" && \
if [ -z ${SYNCTHING_RELEASE+x} ]; then \
SYNCTHING_RELEASE=$(curl -sX GET "https://api.github.com/repos/syncthing/syncthing/releases/latest" \
| awk '/tag_name/{print $4;exit}' FS='[""]'); \
fi && \
mkdir -p \
"${SYNC_BUILD}" && \
SYNC_TAG=$(curl -sX GET "https://api.github.com/repos/syncthing/syncthing/releases/latest" \
| awk '/tag_name/{print $4;exit}' FS='[""]') && \
curl -o \
/tmp/syncthing-src.tar.gz -L \
"https://github.com/syncthing/syncthing/archive/${SYNC_TAG}.tar.gz" && \
"https://github.com/syncthing/syncthing/archive/${SYNCTHING_RELEASE}.tar.gz" && \
tar xf \
/tmp/syncthing-src.tar.gz -C \
"${SYNC_BUILD}" --strip-components=1 && \
echo "**** compile syncthing ****" && \
cd "${SYNC_BUILD}" && \
export GOPATH="${SYNC_SRC}" && \
go run build.go -no-upgrade -version=${SYNC_TAG} && \
go run build.go -no-upgrade -version=${SYNCTHING_RELEASE} && \
echo "**** install syncthing to tmp folder ****" && \
mkdir -p \
/tmp/bin && \
Expand Down
76 changes: 76 additions & 0 deletions Dockerfile.aarch64
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
FROM lsiobase/alpine.arm64:3.7 as buildstage
# specifically using 3.7 alpine in buildstage
# cgo bug in 1.10x go
# runtime stage uses 3.8 alpine

# build variables
ARG SYNCTHING_RELEASE
ARG SYNC_SRC="/tmp/syncthing"
ARG SYNC_BUILD="$SYNC_SRC/src/github.com/syncthing/syncthing"

RUN \
echo "**** install build packages ****" && \
apk add --no-cache \
curl \
g++ \
gcc \
go \
tar

RUN \
echo "**** fetch source code ****" && \
if [ -z ${SYNCTHING_RELEASE+x} ]; then \
SYNCTHING_RELEASE=$(curl -sX GET "https://api.github.com/repos/syncthing/syncthing/releases/latest" \
| awk '/tag_name/{print $4;exit}' FS='[""]'); \
fi && \
mkdir -p \
"${SYNC_BUILD}" && \
curl -o \
/tmp/syncthing-src.tar.gz -L \
"https://github.com/syncthing/syncthing/archive/${SYNCTHING_RELEASE}.tar.gz" && \
tar xf \
/tmp/syncthing-src.tar.gz -C \
"${SYNC_BUILD}" --strip-components=1 && \
echo "**** compile syncthing ****" && \
cd "${SYNC_BUILD}" && \
export GOPATH="${SYNC_SRC}" && \
go run build.go -no-upgrade -version=${SYNCTHING_RELEASE} && \
echo "**** install syncthing to tmp folder ****" && \
mkdir -p \
/tmp/bin && \
install -D -m755 \
$SYNC_BUILD/bin/syncthing \
/tmp/bin/syncthing && \
for i in $(ls $SYNC_BUILD/bin); \
do if ! [ "$i" = "syncthing" ]; \
then install -Dm 755 $SYNC_BUILD/bin/$i /tmp/bin/$i ; \
fi; \
done

############## runtime stage ##############
FROM lsiobase/alpine.arm64:3.8

# Add qemu to build on x86_64 systems
COPY qemu-aarch64-static /usr/bin

# set version label
ARG BUILD_DATE
ARG VERSION
LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}"
LABEL maintainer="sparklyballs"

# environment settings
ENV HOME="/config"

RUN \
echo "**** create var lib folder ****" && \
install -d -o abc -g abc \
/var/lib/syncthing

# copy files from build stage and local files
COPY --from=buildstage /tmp/bin/ /usr/bin/
COPY root/ /

# ports and volumes
EXPOSE 8384 22000 21027/UDP
VOLUME /config /sync
76 changes: 76 additions & 0 deletions Dockerfile.armhf
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
FROM lsiobase/alpine.armhf:3.7 as buildstage
# specifically using 3.7 alpine in buildstage
# cgo bug in 1.10x go
# runtime stage uses 3.8 alpine

# build variables
ARG SYNCTHING_RELEASE
ARG SYNC_SRC="/tmp/syncthing"
ARG SYNC_BUILD="$SYNC_SRC/src/github.com/syncthing/syncthing"

RUN \
echo "**** install build packages ****" && \
apk add --no-cache \
curl \
g++ \
gcc \
go \
tar

RUN \
echo "**** fetch source code ****" && \
if [ -z ${SYNCTHING_RELEASE+x} ]; then \
SYNCTHING_RELEASE=$(curl -sX GET "https://api.github.com/repos/syncthing/syncthing/releases/latest" \
| awk '/tag_name/{print $4;exit}' FS='[""]'); \
fi && \
mkdir -p \
"${SYNC_BUILD}" && \
curl -o \
/tmp/syncthing-src.tar.gz -L \
"https://github.com/syncthing/syncthing/archive/${SYNCTHING_RELEASE}.tar.gz" && \
tar xf \
/tmp/syncthing-src.tar.gz -C \
"${SYNC_BUILD}" --strip-components=1 && \
echo "**** compile syncthing ****" && \
cd "${SYNC_BUILD}" && \
export GOPATH="${SYNC_SRC}" && \
go run build.go -no-upgrade -version=${SYNCTHING_RELEASE} && \
echo "**** install syncthing to tmp folder ****" && \
mkdir -p \
/tmp/bin && \
install -D -m755 \
$SYNC_BUILD/bin/syncthing \
/tmp/bin/syncthing && \
for i in $(ls $SYNC_BUILD/bin); \
do if ! [ "$i" = "syncthing" ]; \
then install -Dm 755 $SYNC_BUILD/bin/$i /tmp/bin/$i ; \
fi; \
done

############## runtime stage ##############
FROM lsiobase/alpine.armhf:3.8

# Add qemu to build on x86_64 systems
COPY qemu-arm-static /usr/bin

# set version label
ARG BUILD_DATE
ARG VERSION
LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}"
LABEL maintainer="sparklyballs"

# environment settings
ENV HOME="/config"

RUN \
echo "**** create var lib folder ****" && \
install -d -o abc -g abc \
/var/lib/syncthing

# copy files from build stage and local files
COPY --from=buildstage /tmp/bin/ /usr/bin/
COPY root/ /

# ports and volumes
EXPOSE 8384 22000 21027/UDP
VOLUME /config /sync
Loading

0 comments on commit ce58559

Please sign in to comment.