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