-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Redesign Dockerfiles using new ndn-cxx base images
Refs: #5303 Change-Id: I1a78db309e0443410f5b585f3b0318408e30f76d
- Loading branch information
Showing
4 changed files
with
61 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,53 @@ | ||
FROM ghcr.io/named-data/ndn-cxx:latest as builder | ||
# syntax=docker/dockerfile:1 | ||
|
||
RUN apt-get update \ | ||
&& apt-get install -y --no-install-recommends libpcap-dev \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
COPY . /NFD | ||
|
||
RUN cd /NFD \ | ||
&& ./waf configure --without-pch --prefix=/usr --sysconfdir=/etc --localstatedir=/var \ | ||
&& ./waf \ | ||
&& ./waf install \ | ||
# get list of dependencies | ||
&& mkdir -p /shlibdeps/debian && cd /shlibdeps && touch debian/control \ | ||
&& dpkg-shlibdeps --ignore-missing-info /usr/lib/libndn-cxx.so* /usr/bin/nfdc /usr/bin/nfd \ | ||
&& sed -n '/^shlibs:Depends=/ s|shlibs:Depends=||p' debian/substvars | sed -e 's|,||g' -e 's| ([^)]*)||g' > /deps.txt | ||
|
||
# use same base distro version as named-data/ndn-cxx | ||
FROM debian:bookworm | ||
ARG NDN_CXX_VERSION=latest | ||
FROM ghcr.io/named-data/ndn-cxx-build:${NDN_CXX_VERSION} AS build | ||
ARG SOURCE_DATE_EPOCH | ||
|
||
COPY --from=builder /deps.txt / | ||
RUN apt-get update \ | ||
&& apt-get install -y --no-install-recommends $(cat /deps.txt) \ | ||
&& rm -rf /var/lib/apt/lists/* /deps.txt | ||
|
||
COPY --from=builder /usr/lib/libndn-cxx.so* /usr/lib/ | ||
COPY --from=builder /usr/bin/nfd /usr/bin/ | ||
COPY --from=builder /usr/bin/nfdc /usr/bin/ | ||
RUN apt-get install -Uy --no-install-recommends \ | ||
libpcap-dev \ | ||
# use 'apt-get distclean' when we upgrade to ubuntu:24.04 | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
COPY --from=builder /usr/bin/nfd-status-http-server /usr/bin/ | ||
COPY --from=builder /usr/share/ndn/ /usr/share/ndn/ | ||
RUN --mount=type=bind,rw,target=/src <<EOF | ||
set -eux | ||
cd /src | ||
./waf configure \ | ||
--prefix=/usr \ | ||
--libdir=/usr/lib \ | ||
--sysconfdir=/etc \ | ||
--localstatedir=/var \ | ||
--sharedstatedir=/var \ | ||
--without-systemd | ||
./waf build | ||
./waf install | ||
|
||
mkdir -p /deps/debian | ||
touch /deps/debian/control | ||
cd /deps | ||
for binary in nfd nfdc nfd-autoreg; do | ||
dpkg-shlibdeps --ignore-missing-info "/usr/bin/${binary}" -O \ | ||
| sed -n 's|^shlibs:Depends=||p' | sed 's| ([^)]*),\?||g' > "${binary}" | ||
done | ||
EOF | ||
|
||
FROM ghcr.io/named-data/ndn-cxx-runtime:${NDN_CXX_VERSION} AS nfd | ||
ARG SOURCE_DATE_EPOCH | ||
|
||
RUN --mount=type=bind,from=build,source=/deps,target=/deps \ | ||
apt-get install -Uy --no-install-recommends $(cat /deps/nfd /deps/nfdc) \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
COPY --from=builder /etc/ndn/nfd.conf.sample /config/nfd.conf | ||
COPY --link --from=build /usr/bin/nfd /usr/bin/ | ||
COPY --link --from=build /usr/bin/nfdc /usr/bin/ | ||
COPY --link --from=build /etc/ndn/nfd.conf.sample /config/nfd.conf | ||
|
||
ENV HOME=/config | ||
|
||
VOLUME /config | ||
VOLUME /run/nfd | ||
|
||
EXPOSE 6363/tcp | ||
EXPOSE 6363/udp | ||
EXPOSE 9696/tcp | ||
EXPOSE 6363/tcp 6363/udp 9696/tcp | ||
|
||
ENTRYPOINT ["/usr/bin/nfd"] | ||
CMD ["--config", "/config/nfd.conf"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,22 @@ | ||
FROM ghcr.io/named-data/nfd:latest | ||
# syntax=docker/dockerfile:1 | ||
|
||
RUN apt-get update \ | ||
&& apt-get install -y --no-install-recommends python3 \ | ||
ARG NDN_CXX_VERSION=latest | ||
ARG NFD_VERSION=latest | ||
FROM ghcr.io/named-data/nfd-build:${NFD_VERSION} AS build | ||
|
||
FROM ghcr.io/named-data/ndn-cxx-runtime:${NDN_CXX_VERSION} | ||
|
||
RUN --mount=type=bind,from=build,source=/deps,target=/deps \ | ||
apt-get install -Uy --no-install-recommends $(cat /deps/nfdc) \ | ||
python3 \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
COPY --link --from=build /usr/bin/nfdc /usr/bin/ | ||
COPY --link --from=build /usr/bin/nfd-status-http-server /usr/bin/ | ||
COPY --link --from=build /usr/share/ndn/ /usr/share/ndn/ | ||
|
||
VOLUME /run/nfd | ||
|
||
EXPOSE 8080/tcp | ||
|
||
ENTRYPOINT ["/usr/bin/nfd-status-http-server"] | ||
CMD ["--address", "0.0.0.0", "--port", "8080"] | ||
ENTRYPOINT ["/usr/bin/nfd-status-http-server", "--address", "0.0.0.0"] |