Davide Pesavento | e76d7b5 | 2024-04-09 16:54:01 -0400 | [diff] [blame] | 1 | # syntax=docker/dockerfile:1 |
Varun Patil | 6ba08cd | 2023-11-18 13:54:52 -0800 | [diff] [blame] | 2 | |
Davide Pesavento | e76d7b5 | 2024-04-09 16:54:01 -0400 | [diff] [blame] | 3 | ARG NDN_CXX_VERSION=latest |
| 4 | FROM ghcr.io/named-data/ndn-cxx-build:${NDN_CXX_VERSION} AS build |
| 5 | ARG SOURCE_DATE_EPOCH |
| 6 | |
| 7 | RUN apt-get install -Uy --no-install-recommends \ |
| 8 | libpcap-dev \ |
| 9 | # use 'apt-get distclean' when we upgrade to ubuntu:24.04 |
Varun Patil | 6ba08cd | 2023-11-18 13:54:52 -0800 | [diff] [blame] | 10 | && rm -rf /var/lib/apt/lists/* |
| 11 | |
Davide Pesavento | e76d7b5 | 2024-04-09 16:54:01 -0400 | [diff] [blame] | 12 | RUN --mount=type=bind,rw,target=/src <<EOF |
| 13 | set -eux |
| 14 | cd /src |
| 15 | ./waf configure \ |
| 16 | --prefix=/usr \ |
| 17 | --libdir=/usr/lib \ |
| 18 | --sysconfdir=/etc \ |
| 19 | --localstatedir=/var \ |
| 20 | --sharedstatedir=/var \ |
| 21 | --without-systemd |
| 22 | ./waf build |
| 23 | ./waf install |
Varun Patil | 6ba08cd | 2023-11-18 13:54:52 -0800 | [diff] [blame] | 24 | |
Davide Pesavento | e76d7b5 | 2024-04-09 16:54:01 -0400 | [diff] [blame] | 25 | mkdir -p /deps/debian |
| 26 | touch /deps/debian/control |
| 27 | cd /deps |
| 28 | for binary in nfd nfdc nfd-autoreg; do |
| 29 | dpkg-shlibdeps --ignore-missing-info "/usr/bin/${binary}" -O \ |
| 30 | | sed -n 's|^shlibs:Depends=||p' | sed 's| ([^)]*),\?||g' > "${binary}" |
| 31 | done |
| 32 | EOF |
Varun Patil | 6ba08cd | 2023-11-18 13:54:52 -0800 | [diff] [blame] | 33 | |
Davide Pesavento | 01d0aa6 | 2024-04-12 00:30:05 -0400 | [diff] [blame^] | 34 | |
| 35 | FROM ghcr.io/named-data/ndn-cxx-runtime:${NDN_CXX_VERSION} AS nfd-autoreg |
| 36 | |
| 37 | COPY --link --from=build /usr/bin/nfd-autoreg /usr/bin/ |
| 38 | |
| 39 | RUN --mount=type=bind,from=build,source=/deps,target=/deps \ |
| 40 | apt-get install -Uy --no-install-recommends $(cat /deps/nfd-autoreg) \ |
| 41 | && rm -rf /var/lib/apt/lists/* |
| 42 | |
| 43 | VOLUME /run/nfd |
| 44 | |
| 45 | ENTRYPOINT ["/usr/bin/nfd-autoreg"] |
| 46 | |
| 47 | |
| 48 | FROM ghcr.io/named-data/ndn-cxx-runtime:${NDN_CXX_VERSION} AS nfd-status-http-server |
| 49 | |
| 50 | COPY --link --from=build /usr/bin/nfdc /usr/bin/ |
| 51 | COPY --link --from=build /usr/bin/nfd-status-http-server /usr/bin/ |
| 52 | COPY --link --from=build /usr/share/ndn/ /usr/share/ndn/ |
| 53 | |
| 54 | RUN --mount=type=bind,from=build,source=/deps,target=/deps \ |
| 55 | apt-get install -Uy --no-install-recommends $(cat /deps/nfdc) \ |
| 56 | python3 \ |
| 57 | && rm -rf /var/lib/apt/lists/* |
| 58 | |
| 59 | VOLUME /run/nfd |
| 60 | |
| 61 | EXPOSE 8080/tcp |
| 62 | |
| 63 | ENTRYPOINT ["/usr/bin/nfd-status-http-server", "--address", "0.0.0.0"] |
| 64 | |
| 65 | |
Davide Pesavento | e76d7b5 | 2024-04-09 16:54:01 -0400 | [diff] [blame] | 66 | FROM ghcr.io/named-data/ndn-cxx-runtime:${NDN_CXX_VERSION} AS nfd |
Davide Pesavento | 01d0aa6 | 2024-04-12 00:30:05 -0400 | [diff] [blame^] | 67 | |
| 68 | COPY --link --from=build /usr/bin/nfdc /usr/bin/ |
| 69 | COPY --link --from=build /usr/bin/nfd /usr/bin/ |
| 70 | COPY --link --from=build /etc/ndn/nfd.conf.sample /config/nfd.conf |
Varun Patil | 6ba08cd | 2023-11-18 13:54:52 -0800 | [diff] [blame] | 71 | |
Davide Pesavento | e76d7b5 | 2024-04-09 16:54:01 -0400 | [diff] [blame] | 72 | RUN --mount=type=bind,from=build,source=/deps,target=/deps \ |
| 73 | apt-get install -Uy --no-install-recommends $(cat /deps/nfd /deps/nfdc) \ |
| 74 | && rm -rf /var/lib/apt/lists/* |
Varun Patil | 6ba08cd | 2023-11-18 13:54:52 -0800 | [diff] [blame] | 75 | |
Varun Patil | 9b877c3 | 2023-11-18 17:48:49 -0800 | [diff] [blame] | 76 | ENV HOME=/config |
Varun Patil | 6ba08cd | 2023-11-18 13:54:52 -0800 | [diff] [blame] | 77 | VOLUME /config |
| 78 | VOLUME /run/nfd |
| 79 | |
Davide Pesavento | e76d7b5 | 2024-04-09 16:54:01 -0400 | [diff] [blame] | 80 | EXPOSE 6363/tcp 6363/udp 9696/tcp |
Varun Patil | 6ba08cd | 2023-11-18 13:54:52 -0800 | [diff] [blame] | 81 | |
| 82 | ENTRYPOINT ["/usr/bin/nfd"] |
| 83 | CMD ["--config", "/config/nfd.conf"] |