From 35e6aff92174ad9502ba8868a475a631acf66a99 Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Sat, 4 May 2024 14:14:06 -0700 Subject: [PATCH] build+ci: add Dockerfile and workflow Refs: #5303 Change-Id: I757249bfc247a581c8dc9c782fef767561fd6896 --- .dockerignore | 27 +++++++++++++++++++ .github/workflows/docker.yml | 19 ++++++++++++++ Dockerfile | 50 ++++++++++++++++++++++++++++++++++++ 3 files changed, 96 insertions(+) create mode 100644 .dockerignore create mode 100644 .github/workflows/docker.yml create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..3c7f02d --- /dev/null +++ b/.dockerignore @@ -0,0 +1,27 @@ +# Waf build system +build/ +.waf-*-*/ +.waf3-*-*/ +.lock-waf* + +# Compiled python code +**/__pycache__/ +**/*.py[cod] + +# Qt Creator +*.creator +*.creator.user +.qtc_clangd/ + +# Visual Studio Code +.vscode/ + +# macOS +**/.DS_Store +**/.AppleDouble +**/.LSOverride +**/._* + +# Other +Dockerfile +VERSION.info diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..9827007 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,19 @@ +name: Docker +on: + push: + tags: + - 'ndn-tools-*' + schedule: + # twice a month + - cron: '20 10 5,20 * *' + workflow_dispatch: + +permissions: + packages: write + id-token: write + +jobs: + ndn-tools: + uses: named-data/actions/.github/workflows/docker-image.yml@v1 + with: + name: ndn-tools diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..bf5965c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,50 @@ +# syntax=docker/dockerfile:1 + +ARG NDN_CXX_VERSION=latest +FROM ghcr.io/named-data/ndn-cxx-build:${NDN_CXX_VERSION} AS build + +RUN apt-get install -Uy --no-install-recommends \ + libpcap-dev \ + && apt-get distclean + +ARG JOBS +ARG SOURCE_DATE_EPOCH +RUN --mount=rw,target=/src < "${binary}" + done +EOF + + +FROM ghcr.io/named-data/ndn-cxx-runtime:${NDN_CXX_VERSION} AS ndn-tools + +COPY --link --from=build /usr/bin/ndnpeek /usr/bin/ +COPY --link --from=build /usr/bin/ndnpoke /usr/bin/ +COPY --link --from=build /usr/bin/ndncatchunks /usr/bin/ +COPY --link --from=build /usr/bin/ndnputchunks /usr/bin/ +COPY --link --from=build /usr/bin/ndnping /usr/bin/ +COPY --link --from=build /usr/bin/ndnpingserver /usr/bin/ +COPY --link --from=build /usr/bin/ndndump /usr/bin/ +COPY --link --from=build /usr/bin/ndn-dissect /usr/bin/ + +RUN --mount=from=build,source=/deps,target=/deps \ + apt-get install -Uy --no-install-recommends $(cat /deps/ndn*) \ + && apt-get distclean + +ENV HOME=/config +VOLUME /config +VOLUME /run/nfd