[UPD]Synchting image

This commit is contained in:
Fabien BOURGEOIS 2019-03-10 14:40:41 +01:00
parent 013c29cb44
commit 37868cce58

View File

@ -1,17 +1,13 @@
FROM golang:1.10 AS builder FROM golang:1.11 AS builder
MAINTAINER Yaltik - Fabien Bourgeois <fabien@yaltik.com> MAINTAINER Yaltik - Fabien Bourgeois <fabien@yaltik.com>
ENV VERSION v0.14.52 WORKDIR /src
RUN mkdir -p /go/src/github.com/syncthing/syncthing
RUN git clone --branch "${VERSION}" --depth 1 https://github.com/syncthing/syncthing /go/src/github.com/syncthing/syncthing
WORKDIR /go/src/github.com/syncthing/syncthing
COPY . . COPY . .
ENV CGO_ENABLED=0 ENV CGO_ENABLED=0
ENV BUILD_HOST=syncthing.net ENV BUILD_HOST=syncthing.net
ENV BUILD_USER=docker ENV BUILD_USER=docker
RUN rm -f syncthing && go run build.go build syncthing RUN rm -f syncthing && go run build.go -no-upgrade build syncthing
FROM alpine FROM alpine
@ -19,38 +15,19 @@ EXPOSE 8384 22000 21027/udp
VOLUME ["/var/syncthing"] VOLUME ["/var/syncthing"]
RUN apk add --no-cache ca-certificates RUN apk add --no-cache ca-certificates su-exec
COPY --from=builder /go/src/github.com/syncthing/syncthing/syncthing /bin/syncthing COPY --from=builder /src/syncthing /bin/syncthing
RUN apk add --no-cache su-exec ENV PUID=1000 PGID=1000
ENV STNOUPGRADE=1
ENV PUSR=syncthing
ENV PUID=1000
ENV PGRP=syncthing
ENV PGID=1000
# Remove HEALTHCHECK because kernel panic on debian jessie...
# HEALTHCHECK --interval=1m --timeout=10s \ # HEALTHCHECK --interval=1m --timeout=10s \
# CMD nc -z localhost 8384 || exit 1 # CMD nc -z localhost 8384 || exit 1
ENTRYPOINT true \ ENTRYPOINT \
&& ( getent group "${PGRP}" >/dev/null \ chown "${PUID}:${PGID}" /var/syncthing \
|| addgroup \ && su-exec "${PUID}:${PGID}" \
-g "${PGID}" \ env HOME=/var/syncthing \
"${PGRP}" \
) \
&& ( getent passwd "${PUSR}" >/dev/null \
|| adduser \
-h /var/syncthing \
-G "${PGRP}" \
-u "${PUID}" \
"${PUSR}" \
) \
&& chown "${PUSR}:${PGRP}" /var/syncthing \
&& su-exec "${PUSR}:${PGRP}" \
/bin/syncthing \ /bin/syncthing \
-home /var/syncthing/config \ -home /var/syncthing/config \
-gui-address 0.0.0.0:8384 \ -gui-address 0.0.0.0:8384
&& true