From 8c34c92b489810c1065214af0376a08c6f6ac498 Mon Sep 17 00:00:00 2001 From: Jan David Mol <mol@astron.nl> Date: Wed, 3 Feb 2016 21:44:43 +0000 Subject: [PATCH] Task #9048: Use UID of caller of Docker as UID to build image with --- .gitattributes | 2 +- Docker/CMakeLists.txt | 1 + Docker/lofar-base/{Dockerfile => Dockerfile.tmpl} | 2 +- Docker/template.in | 7 ++++++- 4 files changed, 9 insertions(+), 3 deletions(-) rename Docker/lofar-base/{Dockerfile => Dockerfile.tmpl} (99%) diff --git a/.gitattributes b/.gitattributes index 770d78c0436..94239568fbd 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2345,7 +2345,7 @@ CMake/variants/variants.node521 -text CMake/variants/variants.phi -text CMake/variants/variants.sharkbay -text Docker/build.sh.example -text -Docker/lofar-base/Dockerfile -text +Docker/lofar-base/Dockerfile.tmpl -text Docker/lofar-base/bashrc -text Docker/lofar-base/chuser.sh -text Docker/lofar-base/subversion_servers -text diff --git a/Docker/CMakeLists.txt b/Docker/CMakeLists.txt index a8d53db4df8..316483f662f 100644 --- a/Docker/CMakeLists.txt +++ b/Docker/CMakeLists.txt @@ -15,6 +15,7 @@ lofar_find_package(Subversion REQUIRED) # Directories with Dockerfile.tmpl to parse set(DOCKER_TEMPLATE_DIRS + lofar-base lofar-pipeline lofar-outputproc) diff --git a/Docker/lofar-base/Dockerfile b/Docker/lofar-base/Dockerfile.tmpl similarity index 99% rename from Docker/lofar-base/Dockerfile rename to Docker/lofar-base/Dockerfile.tmpl index e439b93b317..6092e7d19cc 100644 --- a/Docker/lofar-base/Dockerfile +++ b/Docker/lofar-base/Dockerfile.tmpl @@ -28,7 +28,7 @@ ENV CFITSIO_VERSION=3370 \ # # set-uid # -ENV UID=1001 +ENV UID=${BUILD_UID} # # set-build-options diff --git a/Docker/template.in b/Docker/template.in index 37b5dea9e7a..d134f8bdd08 100755 --- a/Docker/template.in +++ b/Docker/template.in @@ -10,6 +10,7 @@ # ${BRANCH_URL} = Full subversion URL for this branch # ${REVISION} = SVN revision number of this checkout # ${NOW} = now in UTC (format: 2016-01-01 10:11:12) +# ${BUILD_UID} = uid of building user (=caller) # # ----- BRANCH_NAME = branches/LOFAR-Task1234 ----- @@ -50,8 +51,12 @@ export REVISION=`echo "$SVN_INFO" | perl -ne 'print "$1" if /Revision: +(.+)/;'` export NOW="`date -u +'%F %T'`" +# ----- BUILD_UID = 1001 ---- + +export BUILD_UID=`id -u` + # ----- Process input ----- # Insert our knowledge when processing stdin -> stdout -envsubst '$BRANCH_NAME $BRANCH_URL $REVISION $NOW' +envsubst '$BRANCH_NAME $BRANCH_URL $REVISION $NOW $BUILD_UID' -- GitLab