Skip to content

Commit f00a65b

Browse files
authored
Merge pull request #20 from linuxserver/buildstage
bump alpine 3.8 and use buildstage type build
2 parents 79e0dab + 053bf6e commit f00a65b

File tree

2 files changed

+39
-27
lines changed

2 files changed

+39
-27
lines changed

Dockerfile

Lines changed: 38 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,25 @@
1-
FROM lsiobase/alpine:3.7
1+
FROM lsiobase/alpine: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
25

3-
# set version label
4-
ARG BUILD_DATE
5-
ARG VERSION
6-
LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}"
7-
LABEL maintainer="sparklyballs"
8-
9-
# environment settings
6+
# build variables
107
ARG SYNC_SRC="/tmp/syncthing"
118
ARG SYNC_BUILD="$SYNC_SRC/src/github.com/syncthing/syncthing"
12-
ENV HOME="/config"
139

1410
RUN \
1511
echo "**** install build packages ****" && \
16-
apk add --no-cache --virtual=build-dependencies \
12+
apk add --no-cache \
1713
curl \
1814
g++ \
1915
gcc \
2016
go \
21-
tar && \
22-
echo "**** compile syncthing ****" && \
17+
tar
18+
19+
RUN \
20+
echo "**** fetch source code ****" && \
2321
mkdir -p \
2422
"${SYNC_BUILD}" && \
25-
export GOPATH="${SYNC_SRC}" && \
2623
SYNC_TAG=$(curl -sX GET "https://api.github.com/repos/syncthing/syncthing/releases/latest" \
2724
| awk '/tag_name/{print $4;exit}' FS='[""]') && \
2825
curl -o \
@@ -31,27 +28,41 @@ RUN \
3128
tar xf \
3229
/tmp/syncthing-src.tar.gz -C \
3330
"${SYNC_BUILD}" --strip-components=1 && \
31+
echo "**** compile syncthing ****" && \
3432
cd "${SYNC_BUILD}" && \
33+
export GOPATH="${SYNC_SRC}" && \
3534
go run build.go -no-upgrade -version=${SYNC_TAG} && \
36-
echo "**** install syncthing ****" && \
37-
install -d -o abc -g abc \
38-
/var/lib/syncthing && \
35+
echo "**** install syncthing to tmp folder ****" && \
36+
mkdir -p \
37+
/tmp/bin && \
3938
install -D -m755 \
4039
$SYNC_BUILD/bin/syncthing \
41-
/usr/bin/syncthing && \
40+
/tmp/bin/syncthing && \
4241
for i in $(ls $SYNC_BUILD/bin); \
4342
do if ! [ "$i" = "syncthing" ]; \
44-
then install -Dm 755 $SYNC_BUILD/bin/$i /usr/bin/$i ; \
43+
then install -Dm 755 $SYNC_BUILD/bin/$i /tmp/bin/$i ; \
4544
fi; \
46-
done && \
47-
export GOPATH="" && \
48-
echo "**** cleanup ****" && \
49-
apk del --purge \
50-
build-dependencies && \
51-
rm -rf \
52-
/tmp/*
53-
54-
# add local files
45+
done
46+
47+
############## runtime stage ##############
48+
FROM lsiobase/alpine:3.8
49+
50+
# set version label
51+
ARG BUILD_DATE
52+
ARG VERSION
53+
LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}"
54+
LABEL maintainer="sparklyballs"
55+
56+
# environment settings
57+
ENV HOME="/config"
58+
59+
RUN \
60+
echo "**** create var lib folder ****" && \
61+
install -d -o abc -g abc \
62+
/var/lib/syncthing
63+
64+
# copy files from build stage and local files
65+
COPY --from=buildstage /tmp/bin/ /usr/bin/
5566
COPY root/ /
5667

5768
# ports and volumes

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ You can find some of the best documentation available on the web at [docs.syncth
8585

8686
## Versions
8787

88+
+ **30.07.18:** Rebase to alpine 3.8 and use buildstage.
8889
+ **13.12.17:** Rebase to alpine 3.7.
8990
+ **25.10.17:** Add env for manual setting of umask.
9091
+ **29.07.17:** Simplify build structure as symlinks failing on > 0.14.32

0 commit comments

Comments
 (0)