Skip to content

Commit 273b2e4

Browse files
authored
Merge pull request #27 from ilian/fix-user-group-collisions
Fix collisions with existing user and group ids
2 parents 0709178 + f20b0e7 commit 273b2e4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Dockerfile.unix

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ ARG RUBY_VERSION=3.4.1
22
FROM ruby:${RUBY_VERSION}
33
ARG USER_ID=1000
44
ARG GROUP_ID=1000
5-
RUN groupadd -g $GROUP_ID app && useradd -u $USER_ID -g app -m app
6-
USER app
5+
RUN (getent group $GROUP_ID > /dev/null || groupadd -g $GROUP_ID app) && \
6+
(getent passwd $USER_ID > /dev/null || useradd -u $USER_ID -g $GROUP_ID -m app)
7+
USER $USER_ID:$GROUP_ID
78
ARG RAILS_VERSION
89
# Install Rails based on the version specified but if not specified, install the latest version.
910
RUN if [ -z "$RAILS_VERSION" ] ; then gem install rails ; else gem install rails -v $RAILS_VERSION ; fi

0 commit comments

Comments
 (0)