From 25710468dcb926a2c0b526154fd0ad5a9b41a7b3 Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Thu, 12 May 2022 14:19:29 +0200 Subject: [PATCH] Ensure that git commit is set in docker build Signed-off-by: Evan Lezar --- docker/Dockerfile.amazonlinux | 2 ++ docker/Dockerfile.centos | 2 ++ docker/Dockerfile.debian | 2 ++ docker/Dockerfile.opensuse-leap | 2 ++ docker/Dockerfile.ubuntu | 2 ++ docker/docker.mk | 1 + 6 files changed, 11 insertions(+) diff --git a/docker/Dockerfile.amazonlinux b/docker/Dockerfile.amazonlinux index e7a49fcc..77296029 100644 --- a/docker/Dockerfile.amazonlinux +++ b/docker/Dockerfile.amazonlinux @@ -41,6 +41,8 @@ RUN mkdir -p $DIST_DIR /dist WORKDIR $GOPATH/src/nvidia-container-toolkit COPY . . +ARG GIT_COMMIT +ENV GIT_COMMIT ${GIT_COMMIT} RUN make PREFIX=${DIST_DIR} cmds ARG CONFIG_TOML_SUFFIX diff --git a/docker/Dockerfile.centos b/docker/Dockerfile.centos index 38edfeef..abbec683 100644 --- a/docker/Dockerfile.centos +++ b/docker/Dockerfile.centos @@ -41,6 +41,8 @@ RUN mkdir -p $DIST_DIR /dist WORKDIR $GOPATH/src/nvidia-container-toolkit COPY . . +ARG GIT_COMMIT +ENV GIT_COMMIT ${GIT_COMMIT} RUN make PREFIX=${DIST_DIR} cmds ARG CONFIG_TOML_SUFFIX diff --git a/docker/Dockerfile.debian b/docker/Dockerfile.debian index 169984fe..3dcd9627 100644 --- a/docker/Dockerfile.debian +++ b/docker/Dockerfile.debian @@ -48,6 +48,8 @@ RUN mkdir -p $DIST_DIR /dist WORKDIR $GOPATH/src/nvidia-container-toolkit COPY . . +ARG GIT_COMMIT +ENV GIT_COMMIT ${GIT_COMMIT} RUN make PREFIX=${DIST_DIR} cmds ARG CONFIG_TOML_SUFFIX diff --git a/docker/Dockerfile.opensuse-leap b/docker/Dockerfile.opensuse-leap index f57b6e76..fd02f4d5 100644 --- a/docker/Dockerfile.opensuse-leap +++ b/docker/Dockerfile.opensuse-leap @@ -39,6 +39,8 @@ RUN mkdir -p $DIST_DIR /dist WORKDIR $GOPATH/src/nvidia-container-toolkit COPY . . +ARG GIT_COMMIT +ENV GIT_COMMIT ${GIT_COMMIT} RUN make PREFIX=${DIST_DIR} cmds # Hook for Project Atomic's fork of Docker: https://github.com/projectatomic/docker/tree/docker-1.13.1-rhel#add-dockerhooks-exec-custom-hooks-for-prestartpoststop-containerspatch diff --git a/docker/Dockerfile.ubuntu b/docker/Dockerfile.ubuntu index b24835e0..7a5e39b2 100644 --- a/docker/Dockerfile.ubuntu +++ b/docker/Dockerfile.ubuntu @@ -46,6 +46,8 @@ RUN mkdir -p $DIST_DIR /dist WORKDIR $GOPATH/src/nvidia-container-toolkit COPY . . +ARG GIT_COMMIT +ENV GIT_COMMIT ${GIT_COMMIT} RUN make PREFIX=${DIST_DIR} cmds ARG CONFIG_TOML_SUFFIX diff --git a/docker/docker.mk b/docker/docker.mk index f97d3d8a..614b97bc 100644 --- a/docker/docker.mk +++ b/docker/docker.mk @@ -131,6 +131,7 @@ docker-build-%: --build-arg PKG_VERS="$(LIB_VERSION)" \ --build-arg PKG_REV="$(PKG_REV)" \ --build-arg CONFIG_TOML_SUFFIX="$(CONFIG_TOML_SUFFIX)" \ + --build-arg GIT_COMMIT="$(GIT_COMMIT)" \ --tag $(BUILDIMAGE) \ --file $(DOCKERFILE) . $(DOCKER) run \