Skip to content

Commit

Permalink
Merge pull request #27 from ilian/fix-user-group-collisions
Browse files Browse the repository at this point in the history
Fix collisions with existing user and group ids
  • Loading branch information
rafaelfranca authored Jan 16, 2025
2 parents 0709178 + f20b0e7 commit 273b2e4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Dockerfile.unix
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ ARG RUBY_VERSION=3.4.1
FROM ruby:${RUBY_VERSION}
ARG USER_ID=1000
ARG GROUP_ID=1000
RUN groupadd -g $GROUP_ID app && useradd -u $USER_ID -g app -m app
USER app
RUN (getent group $GROUP_ID > /dev/null || groupadd -g $GROUP_ID app) && \
(getent passwd $USER_ID > /dev/null || useradd -u $USER_ID -g $GROUP_ID -m app)
USER $USER_ID:$GROUP_ID
ARG RAILS_VERSION
# Install Rails based on the version specified but if not specified, install the latest version.
RUN if [ -z "$RAILS_VERSION" ] ; then gem install rails ; else gem install rails -v $RAILS_VERSION ; fi

0 comments on commit 273b2e4

Please sign in to comment.