Skip to content

Commit

Permalink
docker: simplify Dockerfile
Browse files Browse the repository at this point in the history
Change-Id: Ib77605ff13d67f5ae14a68d26f2f1caf5acc9572
  • Loading branch information
Pesa committed May 4, 2024
1 parent e1dc79b commit c3bf8ad
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
20 changes: 9 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -22,7 +21,6 @@ cd /src
--without-systemd
./waf build
./waf install

mkdir -p /deps/debian
touch /deps/debian/control
cd /deps
Expand All @@ -37,9 +35,9 @@ 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 \
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

Expand All @@ -52,10 +50,10 @@ 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 \
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

Expand All @@ -70,9 +68,9 @@ 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 \
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
Expand Down
8 changes: 5 additions & 3 deletions wscript
Original file line number Diff line number Diff line change
Expand Up @@ -307,10 +307,12 @@ def version(ctx):
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
Expand Down

0 comments on commit c3bf8ad

Please sign in to comment.