[damned-lies] fix: specify user uid/gid to be used on OpenShift



commit f1cd31702f4c57b60e0c06b49905d02dd9b7668e
Author: Guillaume Bernard <associations guillaume-bernard fr>
Date:   Mon May 9 15:06:24 2022 +0200

    fix: specify user uid/gid to be used on OpenShift

 containers/production/build_buildah_deployment.sh | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/containers/production/build_buildah_deployment.sh 
b/containers/production/build_buildah_deployment.sh
index 59552752..3d0062b1 100755
--- a/containers/production/build_buildah_deployment.sh
+++ b/containers/production/build_buildah_deployment.sh
@@ -3,6 +3,10 @@
 # PROCESS_USER: the user that will run the httpd server and be authorised to access application files
 declare -r PROCESS_USER="l10n"
 
+# PROCESS_USER_UID_GID: the user ID/GID that will be used to create the user. In some environments such as 
OpenShift
+# the container is run with a specific user namespace mapping.
+declare -r PROCESS_USER_UID_GID=1001010000
+
 # DAMNED_LIES_CONTAINER_CODE_DIRECTORY: where is located project code
 declare -r DAMNED_LIES_CONTAINER_CODE_DIRECTORY="/${PROCESS_USER}"
 
@@ -45,8 +49,8 @@ buildah config --author "Guillaume Bernard" "${container}"
 buildah config --label 'maintainer="Guillaume Bernard <associations guillaume-bernard fr>"' "${container}"
 
 # Create PROCESS_USER
-buildah run "${container}" -- groupadd "${PROCESS_USER}"
-buildah run "${container}" -- useradd "${PROCESS_USER}" -g "${PROCESS_USER}" -G apache -r -l -m
+buildah run "${container}" -- groupadd "${PROCESS_USER}" -g ${PROCESS_USER_UID_GID}
+buildah run "${container}" -- useradd "${PROCESS_USER}" -g ${PROCESS_USER_UID_GID} -u 
${PROCESS_USER_UID_GID} -G apache -r -l -m -K SYS_UID_MAX=2000000000
 
 # Prepare HTTPD environment to accept our configuration: redirect output to console
 buildah run "${container}" -- sed -ri 's!^(\s*CustomLog)\s+\S+!\1 /proc/self/fd/1!g; 
s!^(\s*ErrorLog)\s+\S+!\1 /proc/self/fd/2!g;' /etc/httpd/conf/httpd.conf


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]