Skip to content

Commit b30765d

Browse files
authored
Refactor User and Group Creation in Dockerfile for Improved Efficiency and Simplicity (#9490)
refactors the user and group creation process in the Dockerfile to address inefficiencies, reduce redundancy, and enhance simplicity.
1 parent 9c4f41a commit b30765d

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

Dockerfile

+4-9
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,12 @@ RUN curl -LSs "https://github.com/scottchiefbaker/dool/archive/${DOOL_VERSION}.t
4444
tar --strip-components=1 -xz && \
4545
./install.py
4646

47-
# Check if the group ID is already created
47+
# create group and user
4848
ARG GROUP_ID
49-
RUN if ! getent group "$GROUP_ID"; then \
50-
addgroup --gid "$GROUP_ID" user; \
51-
fi
52-
53-
# Check if the user ID is already created
5449
ARG USER_ID
55-
RUN if ! getent passwd "$USER_ID"; then \
56-
adduser --disabled-password --gecos '' --gid "$GROUP_ID" --uid "$USER_ID" user; \
57-
fi
50+
51+
RUN groupadd -g "$GROUP_ID" user || true && \
52+
useradd -m -u "$USER_ID" -g "$GROUP_ID" -s /bin/bash user || true
5853

5954
ENV FWROOT=/FrameworkBenchmarks USER_ID="$USER_ID"
6055
ENV PYTHONPATH="$FWROOT"

0 commit comments

Comments
 (0)