Dockerfile.stdiscosrv 1.2 KB

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