Varun Patil | 70f6db1 | 2024-05-04 18:02:22 -0700 | [diff] [blame] | 1 | # syntax=docker/dockerfile:1 |
| 2 | |
| 3 | ARG NDN_CXX_VERSION=latest |
| 4 | |
| 5 | FROM scratch AS psync |
| 6 | ARG PSYNC_VERSION=master |
| 7 | ADD https://github.com/named-data/PSync.git#${PSYNC_VERSION} / |
| 8 | |
| 9 | FROM ghcr.io/named-data/ndn-cxx-build:${NDN_CXX_VERSION} AS build |
| 10 | |
| 11 | RUN apt-get install -Uy --no-install-recommends \ |
| 12 | libboost-iostreams-dev \ |
| 13 | && apt-get distclean |
| 14 | |
| 15 | ARG JOBS |
| 16 | ARG SOURCE_DATE_EPOCH |
| 17 | RUN --mount=from=psync,rw,target=/psync <<EOF |
| 18 | set -eux |
| 19 | cd /psync |
| 20 | ./waf configure \ |
| 21 | --prefix=/usr \ |
| 22 | --libdir=/usr/lib \ |
| 23 | --sysconfdir=/etc \ |
| 24 | --localstatedir=/var \ |
| 25 | --sharedstatedir=/var |
| 26 | ./waf build |
| 27 | ./waf install |
| 28 | EOF |
| 29 | RUN --mount=rw,target=/src <<EOF |
| 30 | set -eux |
| 31 | cd /src |
| 32 | ./waf configure \ |
| 33 | --prefix=/usr \ |
| 34 | --libdir=/usr/lib \ |
| 35 | --sysconfdir=/etc \ |
| 36 | --localstatedir=/var \ |
| 37 | --sharedstatedir=/var \ |
| 38 | --with-psync |
| 39 | ./waf build |
| 40 | ./waf install |
| 41 | mkdir -p /deps/debian |
| 42 | touch /deps/debian/control |
| 43 | cd /deps |
| 44 | dpkg-shlibdeps --ignore-missing-info /usr/lib/libPSync.so.* /usr/bin/nlsr /usr/bin/nlsrc -O \ |
| 45 | | sed -n 's|^shlibs:Depends=||p' | sed 's| ([^)]*),\?||g' > nlsr |
| 46 | EOF |
| 47 | |
| 48 | |
| 49 | FROM ghcr.io/named-data/ndn-cxx-runtime:${NDN_CXX_VERSION} AS nlsr |
| 50 | |
| 51 | COPY --link --from=build /usr/lib/libPSync.so.* /usr/lib/ |
| 52 | COPY --link --from=build /usr/bin/nlsr /usr/bin/ |
| 53 | COPY --link --from=build /usr/bin/nlsrc /usr/bin/ |
| 54 | COPY --link --from=build /etc/ndn/nlsr.conf.sample /config/nlsr.conf |
| 55 | |
| 56 | RUN --mount=from=build,source=/deps,target=/deps \ |
Davide Pesavento | d96b63a | 2024-06-08 20:18:05 -0400 | [diff] [blame] | 57 | apt-get install -Uy --no-install-recommends \ |
| 58 | $(cat /deps/nlsr) \ |
Varun Patil | 70f6db1 | 2024-05-04 18:02:22 -0700 | [diff] [blame] | 59 | && apt-get distclean |
| 60 | |
| 61 | ENV HOME=/config |
| 62 | VOLUME /config |
| 63 | VOLUME /var/lib/nlsr |
| 64 | VOLUME /run/nfd |
| 65 | |
| 66 | ENTRYPOINT ["/usr/bin/nlsr"] |
| 67 | CMD ["-f", "/config/nlsr.conf"] |