Merge the Dockerfiles, add nfd-autoreg target
Refs: #5303
Change-Id: I1f1babbb38cfc702218f844d30b81914ca5c274f
diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml
index 53554df..d21badd 100644
--- a/.github/workflows/docker.yml
+++ b/.github/workflows/docker.yml
@@ -46,18 +46,19 @@
uses: docker/build-push-action@v5
with:
context: .
+ target: nfd
pull: true
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
nfd-status-http-server:
- needs: nfd
runs-on: ubuntu-latest
-
steps:
- name: Checkout repository
uses: actions/checkout@v4
+ with:
+ submodules: true
- name: Login to ${{ env.REGISTRY }}
uses: docker/login-action@v3
@@ -76,8 +77,8 @@
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
- context: ./tools
- file: ./tools/Dockerfile.nfd-status-http-server
+ context: .
+ target: nfd-status-http-server
pull: true
push: true
tags: ${{ steps.meta.outputs.tags }}
diff --git a/Dockerfile b/Dockerfile
index 1b53e3b..0409463 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -31,19 +31,49 @@
done
EOF
+
+FROM ghcr.io/named-data/ndn-cxx-runtime:${NDN_CXX_VERSION} AS nfd-autoreg
+
+COPY --link --from=build /usr/bin/nfd-autoreg /usr/bin/
+
+RUN --mount=type=bind,from=build,source=/deps,target=/deps \
+ apt-get install -Uy --no-install-recommends $(cat /deps/nfd-autoreg) \
+ && rm -rf /var/lib/apt/lists/*
+
+VOLUME /run/nfd
+
+ENTRYPOINT ["/usr/bin/nfd-autoreg"]
+
+
+FROM ghcr.io/named-data/ndn-cxx-runtime:${NDN_CXX_VERSION} AS nfd-status-http-server
+
+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/
+
+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/*
+
+VOLUME /run/nfd
+
+EXPOSE 8080/tcp
+
+ENTRYPOINT ["/usr/bin/nfd-status-http-server", "--address", "0.0.0.0"]
+
+
FROM ghcr.io/named-data/ndn-cxx-runtime:${NDN_CXX_VERSION} AS nfd
-ARG SOURCE_DATE_EPOCH
+
+COPY --link --from=build /usr/bin/nfdc /usr/bin/
+COPY --link --from=build /usr/bin/nfd /usr/bin/
+COPY --link --from=build /etc/ndn/nfd.conf.sample /config/nfd.conf
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 --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
diff --git a/tools/Dockerfile.nfd-status-http-server b/tools/Dockerfile.nfd-status-http-server
deleted file mode 100644
index 179f9a6..0000000
--- a/tools/Dockerfile.nfd-status-http-server
+++ /dev/null
@@ -1,22 +0,0 @@
-# syntax=docker/dockerfile:1
-
-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", "--address", "0.0.0.0"]