docker: simplify Dockerfile
Change-Id: Ib77605ff13d67f5ae14a68d26f2f1caf5acc9572
diff --git a/Dockerfile b/Dockerfile
index c266881..2f51138 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -2,15 +2,14 @@
ARG NDN_CXX_VERSION=latest
FROM ghcr.io/named-data/ndn-cxx-build:${NDN_CXX_VERSION} AS build
-ARG SOURCE_DATE_EPOCH
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/*
+ && apt-get distclean
ARG JOBS
-RUN --mount=type=bind,rw,target=/src <<EOF
+ARG SOURCE_DATE_EPOCH
+RUN --mount=rw,target=/src <<EOF
set -eux
cd /src
./waf configure \
@@ -22,7 +21,6 @@
--without-systemd
./waf build
./waf install
-
mkdir -p /deps/debian
touch /deps/debian/control
cd /deps
@@ -37,9 +35,9 @@
COPY --link --from=build /usr/bin/nfd-autoreg /usr/bin/
-RUN --mount=type=bind,from=build,source=/deps,target=/deps \
+RUN --mount=from=build,source=/deps,target=/deps \
apt-get install -Uy --no-install-recommends $(cat /deps/nfd-autoreg) \
- && rm -rf /var/lib/apt/lists/*
+ && apt-get distclean
VOLUME /run/nfd
@@ -52,10 +50,10 @@
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 \
+RUN --mount=from=build,source=/deps,target=/deps \
apt-get install -Uy --no-install-recommends $(cat /deps/nfdc) \
python3 \
- && rm -rf /var/lib/apt/lists/*
+ && apt-get distclean
VOLUME /run/nfd
@@ -70,9 +68,9 @@
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 \
+RUN --mount=from=build,source=/deps,target=/deps \
apt-get install -Uy --no-install-recommends $(cat /deps/nfd /deps/nfdc) \
- && rm -rf /var/lib/apt/lists/*
+ && apt-get distclean
ENV HOME=/config
VOLUME /config
diff --git a/wscript b/wscript
index 644d739..daaaa96 100644
--- a/wscript
+++ b/wscript
@@ -307,10 +307,12 @@
cmd = ['git', 'describe', '--abbrev=8', '--always', '--match', f'{GIT_TAG_PREFIX}*']
version_from_git = subprocess.run(cmd, capture_output=True, check=True, text=True).stdout.strip()
if version_from_git:
- if version_from_git.startswith(GIT_TAG_PREFIX):
- Context.g_module.VERSION = version_from_git.lstrip(GIT_TAG_PREFIX)
+ if GIT_TAG_PREFIX and version_from_git.startswith(GIT_TAG_PREFIX):
+ Context.g_module.VERSION = version_from_git[len(GIT_TAG_PREFIX):]
+ elif not GIT_TAG_PREFIX and ('.' in version_from_git or '-' in version_from_git):
+ Context.g_module.VERSION = version_from_git
else:
- # no tags matched
+ # no tags matched (or we are in a shallow clone)
Context.g_module.VERSION = f'{VERSION_BASE}+git.{version_from_git}'
except (OSError, subprocess.SubprocessError):
pass