blob: 9d9de95748dae35f4562f938f7566db02c5ff395 [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 \
57 apt-get install -Uy --no-install-recommends $(cat /deps/nlsr) \
58 && apt-get distclean
59
60ENV HOME=/config
61VOLUME /config
62VOLUME /var/lib/nlsr
63VOLUME /run/nfd
64
65ENTRYPOINT ["/usr/bin/nlsr"]
66CMD ["-f", "/config/nlsr.conf"]