Dockerfile.stdiscosrv 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. ARG GOVERSION=latest
  2. FROM golang:$GOVERSION AS builder
  3. ARG BUILD_USER
  4. ARG BUILD_HOST
  5. ARG TARGETARCH
  6. ADD https://github.com/syncthing/syncthing/archive/refs/heads/main.zip /tmp/
  7. RUN apt-get update && apt-get install unzip git -y && unzip /tmp/main.zip -d /tmp && mv /tmp/syncthing-main /src
  8. WORKDIR /src
  9. ENV CGO_ENABLED=0
  10. RUN if [ ! -f stdiscosrv-linux-$TARGETARCH ] ; then \
  11. go run build.go -no-upgrade build stdiscosrv ; \
  12. mv stdiscosrv stdiscosrv-linux-$TARGETARCH ; \
  13. fi
  14. FROM alpine
  15. ARG TARGETARCH
  16. LABEL org.opencontainers.image.authors="The Syncthing Project" \
  17. org.opencontainers.image.url="https://syncthing.net" \
  18. org.opencontainers.image.documentation="https://docs.syncthing.net" \
  19. org.opencontainers.image.source="https://github.com/syncthing/syncthing" \
  20. org.opencontainers.image.vendor="The Syncthing Project" \
  21. org.opencontainers.image.licenses="MPL-2.0" \
  22. org.opencontainers.image.title="Syncthing Discovery Server"
  23. EXPOSE 19200 8443
  24. VOLUME ["/var/stdiscosrv"]
  25. RUN apk add --no-cache ca-certificates su-exec
  26. COPY --from=builder /src/stdiscosrv-linux-$TARGETARCH /bin/stdiscosrv
  27. COPY --from=builder /src/script/docker-entrypoint.sh /bin/entrypoint.sh
  28. ENV PUID=1000 PGID=1000 HOME=/var/stdiscosrv
  29. HEALTHCHECK --interval=1m --timeout=10s \
  30. CMD nc -z localhost 8443 || exit 1
  31. WORKDIR /var/stdiscosrv
  32. ENTRYPOINT ["/bin/entrypoint.sh", "/bin/stdiscosrv"]