blob: 92bc36461b9ab502826454129f3f31979577ea31 [file] [log] [blame]
Varun Patil70f6db12024-05-04 18:02:22 -07001# syntax=docker/dockerfile:1
2
3ARG NDN_CXX_VERSION=latest
4
5FROM scratch AS psync
6ARG PSYNC_VERSION=master
7ADD https://github.com/named-data/PSync.git#${PSYNC_VERSION} /
8
9FROM ghcr.io/named-data/ndn-cxx-build:${NDN_CXX_VERSION} AS build
10
11RUN apt-get install -Uy --no-install-recommends \
12 libboost-iostreams-dev \
13 && apt-get distclean
14
15ARG JOBS
16ARG SOURCE_DATE_EPOCH
17RUN --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
28EOF
29RUN --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
46EOF
47
48
49FROM ghcr.io/named-data/ndn-cxx-runtime:${NDN_CXX_VERSION} AS nlsr
50
51COPY --link --from=build /usr/lib/libPSync.so.* /usr/lib/
52COPY --link --from=build /usr/bin/nlsr /usr/bin/
53COPY --link --from=build /usr/bin/nlsrc /usr/bin/
54COPY --link --from=build /etc/ndn/nlsr.conf.sample /config/nlsr.conf
55
56RUN --mount=from=build,source=/deps,target=/deps \
Davide Pesaventod96b63a2024-06-08 20:18:05 -040057 apt-get install -Uy --no-install-recommends \
58 $(cat /deps/nlsr) \
Varun Patil70f6db12024-05-04 18:02:22 -070059 && apt-get distclean
60
61ENV HOME=/config
62VOLUME /config
63VOLUME /var/lib/nlsr
64VOLUME /run/nfd
65
66ENTRYPOINT ["/usr/bin/nlsr"]
67CMD ["-f", "/config/nlsr.conf"]