Skip to content

Commit ce58559

Browse files
authored
Merge pull request #23 from linuxserver/pipeline
adding pipeline logic and multi arching
2 parents f00a65b + c9e3e4f commit ce58559

File tree

7 files changed

+908
-11
lines changed

7 files changed

+908
-11
lines changed

Dockerfile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ FROM lsiobase/alpine:3.7 as buildstage
44
# runtime stage uses 3.8 alpine
55

66
# build variables
7+
ARG SYNCTHING_RELEASE
78
ARG SYNC_SRC="/tmp/syncthing"
89
ARG SYNC_BUILD="$SYNC_SRC/src/github.com/syncthing/syncthing"
910

@@ -18,20 +19,22 @@ RUN \
1819

1920
RUN \
2021
echo "**** fetch source code ****" && \
22+
if [ -z ${SYNCTHING_RELEASE+x} ]; then \
23+
SYNCTHING_RELEASE=$(curl -sX GET "https://api.github.com/repos/syncthing/syncthing/releases/latest" \
24+
| awk '/tag_name/{print $4;exit}' FS='[""]'); \
25+
fi && \
2126
mkdir -p \
2227
"${SYNC_BUILD}" && \
23-
SYNC_TAG=$(curl -sX GET "https://api.github.com/repos/syncthing/syncthing/releases/latest" \
24-
| awk '/tag_name/{print $4;exit}' FS='[""]') && \
2528
curl -o \
2629
/tmp/syncthing-src.tar.gz -L \
27-
"https://github.com/syncthing/syncthing/archive/${SYNC_TAG}.tar.gz" && \
30+
"https://github.com/syncthing/syncthing/archive/${SYNCTHING_RELEASE}.tar.gz" && \
2831
tar xf \
2932
/tmp/syncthing-src.tar.gz -C \
3033
"${SYNC_BUILD}" --strip-components=1 && \
3134
echo "**** compile syncthing ****" && \
3235
cd "${SYNC_BUILD}" && \
3336
export GOPATH="${SYNC_SRC}" && \
34-
go run build.go -no-upgrade -version=${SYNC_TAG} && \
37+
go run build.go -no-upgrade -version=${SYNCTHING_RELEASE} && \
3538
echo "**** install syncthing to tmp folder ****" && \
3639
mkdir -p \
3740
/tmp/bin && \

Dockerfile.aarch64

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
FROM lsiobase/alpine.arm64:3.7 as buildstage
2+
# specifically using 3.7 alpine in buildstage
3+
# cgo bug in 1.10x go
4+
# runtime stage uses 3.8 alpine
5+
6+
# build variables
7+
ARG SYNCTHING_RELEASE
8+
ARG SYNC_SRC="/tmp/syncthing"
9+
ARG SYNC_BUILD="$SYNC_SRC/src/github.com/syncthing/syncthing"
10+
11+
RUN \
12+
echo "**** install build packages ****" && \
13+
apk add --no-cache \
14+
curl \
15+
g++ \
16+
gcc \
17+
go \
18+
tar
19+
20+
RUN \
21+
echo "**** fetch source code ****" && \
22+
if [ -z ${SYNCTHING_RELEASE+x} ]; then \
23+
SYNCTHING_RELEASE=$(curl -sX GET "https://api.github.com/repos/syncthing/syncthing/releases/latest" \
24+
| awk '/tag_name/{print $4;exit}' FS='[""]'); \
25+
fi && \
26+
mkdir -p \
27+
"${SYNC_BUILD}" && \
28+
curl -o \
29+
/tmp/syncthing-src.tar.gz -L \
30+
"https://github.com/syncthing/syncthing/archive/${SYNCTHING_RELEASE}.tar.gz" && \
31+
tar xf \
32+
/tmp/syncthing-src.tar.gz -C \
33+
"${SYNC_BUILD}" --strip-components=1 && \
34+
echo "**** compile syncthing ****" && \
35+
cd "${SYNC_BUILD}" && \
36+
export GOPATH="${SYNC_SRC}" && \
37+
go run build.go -no-upgrade -version=${SYNCTHING_RELEASE} && \
38+
echo "**** install syncthing to tmp folder ****" && \
39+
mkdir -p \
40+
/tmp/bin && \
41+
install -D -m755 \
42+
$SYNC_BUILD/bin/syncthing \
43+
/tmp/bin/syncthing && \
44+
for i in $(ls $SYNC_BUILD/bin); \
45+
do if ! [ "$i" = "syncthing" ]; \
46+
then install -Dm 755 $SYNC_BUILD/bin/$i /tmp/bin/$i ; \
47+
fi; \
48+
done
49+
50+
############## runtime stage ##############
51+
FROM lsiobase/alpine.arm64:3.8
52+
53+
# Add qemu to build on x86_64 systems
54+
COPY qemu-aarch64-static /usr/bin
55+
56+
# set version label
57+
ARG BUILD_DATE
58+
ARG VERSION
59+
LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}"
60+
LABEL maintainer="sparklyballs"
61+
62+
# environment settings
63+
ENV HOME="/config"
64+
65+
RUN \
66+
echo "**** create var lib folder ****" && \
67+
install -d -o abc -g abc \
68+
/var/lib/syncthing
69+
70+
# copy files from build stage and local files
71+
COPY --from=buildstage /tmp/bin/ /usr/bin/
72+
COPY root/ /
73+
74+
# ports and volumes
75+
EXPOSE 8384 22000 21027/UDP
76+
VOLUME /config /sync

Dockerfile.armhf

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
FROM lsiobase/alpine.armhf:3.7 as buildstage
2+
# specifically using 3.7 alpine in buildstage
3+
# cgo bug in 1.10x go
4+
# runtime stage uses 3.8 alpine
5+
6+
# build variables
7+
ARG SYNCTHING_RELEASE
8+
ARG SYNC_SRC="/tmp/syncthing"
9+
ARG SYNC_BUILD="$SYNC_SRC/src/github.com/syncthing/syncthing"
10+
11+
RUN \
12+
echo "**** install build packages ****" && \
13+
apk add --no-cache \
14+
curl \
15+
g++ \
16+
gcc \
17+
go \
18+
tar
19+
20+
RUN \
21+
echo "**** fetch source code ****" && \
22+
if [ -z ${SYNCTHING_RELEASE+x} ]; then \
23+
SYNCTHING_RELEASE=$(curl -sX GET "https://api.github.com/repos/syncthing/syncthing/releases/latest" \
24+
| awk '/tag_name/{print $4;exit}' FS='[""]'); \
25+
fi && \
26+
mkdir -p \
27+
"${SYNC_BUILD}" && \
28+
curl -o \
29+
/tmp/syncthing-src.tar.gz -L \
30+
"https://github.com/syncthing/syncthing/archive/${SYNCTHING_RELEASE}.tar.gz" && \
31+
tar xf \
32+
/tmp/syncthing-src.tar.gz -C \
33+
"${SYNC_BUILD}" --strip-components=1 && \
34+
echo "**** compile syncthing ****" && \
35+
cd "${SYNC_BUILD}" && \
36+
export GOPATH="${SYNC_SRC}" && \
37+
go run build.go -no-upgrade -version=${SYNCTHING_RELEASE} && \
38+
echo "**** install syncthing to tmp folder ****" && \
39+
mkdir -p \
40+
/tmp/bin && \
41+
install -D -m755 \
42+
$SYNC_BUILD/bin/syncthing \
43+
/tmp/bin/syncthing && \
44+
for i in $(ls $SYNC_BUILD/bin); \
45+
do if ! [ "$i" = "syncthing" ]; \
46+
then install -Dm 755 $SYNC_BUILD/bin/$i /tmp/bin/$i ; \
47+
fi; \
48+
done
49+
50+
############## runtime stage ##############
51+
FROM lsiobase/alpine.armhf:3.8
52+
53+
# Add qemu to build on x86_64 systems
54+
COPY qemu-arm-static /usr/bin
55+
56+
# set version label
57+
ARG BUILD_DATE
58+
ARG VERSION
59+
LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}"
60+
LABEL maintainer="sparklyballs"
61+
62+
# environment settings
63+
ENV HOME="/config"
64+
65+
RUN \
66+
echo "**** create var lib folder ****" && \
67+
install -d -o abc -g abc \
68+
/var/lib/syncthing
69+
70+
# copy files from build stage and local files
71+
COPY --from=buildstage /tmp/bin/ /usr/bin/
72+
COPY root/ /
73+
74+
# ports and volumes
75+
EXPOSE 8384 22000 21027/UDP
76+
VOLUME /config /sync

0 commit comments

Comments
 (0)