From 8c57e55b59a8c391b084848d3ef105968c9b3450 Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Mon, 23 Jan 2023 14:53:02 +0100 Subject: [PATCH] Add additional information to the manifest Signed-off-by: Evan Lezar --- build/container/Dockerfile.packaging | 12 +++++++++--- build/container/Makefile | 3 +++ versions.mk | 2 ++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/build/container/Dockerfile.packaging b/build/container/Dockerfile.packaging index 6873de41..d788b7d7 100644 --- a/build/container/Dockerfile.packaging +++ b/build/container/Dockerfile.packaging @@ -15,17 +15,23 @@ ARG BASE_DIST ARG CUDA_VERSION ARG GOLANG_VERSION=x.x.x -ARG VERSION="N/A" FROM nvidia/cuda:${CUDA_VERSION}-base-${BASE_DIST} -ENV NVIDIA_CONTAINER_TOOLKIT_VERSION="${VERSION}" +ARG VERSION="N/A" ARG ARTIFACTS_ROOT COPY ${ARTIFACTS_ROOT} /artifacts/packages/ WORKDIR /artifacts/packages + +ARG GIT_BRANCH +ARG GIT_COMMIT +ARG SOURCE_DATE_EPOCH + # Create a manifest.txt file with the absolute paths of all deb and rpm packages in the container -RUN find /artifacts/packages -iname '*.deb' -o -iname '*.rpm' > /artifacts/manifest.txt +RUN echo "IMAGE_EPOCH=$(date '+%s')" | sed 's/^/#/g' > /artifacts/manifest.txt && \ + env | sed 's/^/#/g' >> /artifacts/manifest.txt && \ + find /artifacts/packages -iname '*.deb' -o -iname '*.rpm' >> /artifacts/manifest.txt RUN mkdir /licenses && mv /NGC-DL-CONTAINER-LICENSE /licenses/NGC-DL-CONTAINER-LICENSE diff --git a/build/container/Makefile b/build/container/Makefile index d69b1b69..32fd8fa6 100644 --- a/build/container/Makefile +++ b/build/container/Makefile @@ -94,6 +94,9 @@ $(BUILD_TARGETS): build-%: $(ARTIFACTS_ROOT) --build-arg PACKAGE_DIST="$(PACKAGE_DIST)" \ --build-arg PACKAGE_VERSION="$(PACKAGE_VERSION)" \ --build-arg VERSION="$(VERSION)" \ + --build-arg GIT_COMMIT="$(GIT_COMMIT)" \ + --build-arg GIT_BRANCH="$(GIT_BRANCH)" \ + --build-arg SOURCE_DATE_EPOCH="$(SOURCE_DATE_EPOCH)" \ --build-arg CVE_UPDATES="$(CVE_UPDATES)" \ -f $(DOCKERFILE) \ $(CURDIR) diff --git a/versions.mk b/versions.mk index 45ef77bd..bed58cee 100644 --- a/versions.mk +++ b/versions.mk @@ -29,3 +29,5 @@ CUDA_VERSION := 11.8.0 GOLANG_VERSION := 1.18.8 GIT_COMMIT ?= $(shell git describe --match="" --dirty --long --always --abbrev=40 2> /dev/null || echo "") +GIT_BRANCH ?= $(git rev-parse --abbrev-ref HEAD /dev/null || echo "${GIT_COMMIT}") +SOURCE_DATE_EPOCH ?= $(shell git log -1 --format=%ct 2> /dev/null || echo "")