From ee7230eb9dcf6cf3eec6a0905e5d6580d3424db4 Mon Sep 17 00:00:00 2001 From: Roni Choudhury Date: Mon, 11 Nov 2024 11:54:48 -0500 Subject: [PATCH] Use getent for conditional user creation --- dev/django.Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/django.Dockerfile b/dev/django.Dockerfile index 106340583..be96216be 100644 --- a/dev/django.Dockerfile +++ b/dev/django.Dockerfile @@ -19,7 +19,7 @@ ARG LOGIN=root ARG GROUPID=0 ARG GROUPNAME=root RUN getent group ${GROUPID} || addgroup --gid ${GROUPID} ${GROUPNAME} -RUN if [ "${USERID}" != 0 ]; then adduser --uid ${USERID} --gid ${GROUPID} --home /home/${LOGIN} $LOGIN; fi +RUN getent passwd ${USERID} || adduser --allow-bad-names --uid ${USERID} --gid ${GROUPID} --home /home/${LOGIN} $LOGIN # Create the project folder and make the user its owner. RUN mkdir -p /opt/django-project