Skip to content

Commit

Permalink
Be user we wanna be
Browse files Browse the repository at this point in the history
  • Loading branch information
nbudin committed Sep 12, 2023
1 parent 0182e58 commit 2d14513
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ RUN apt-get update -qq && \
apt-get install --no-install-recommends -y libpq5 nodejs && \
rm -rf /var/lib/apt/lists /var/cache/apt/archives

# Copy built artifacts: gems, application
COPY --from=build /usr/local/bundle /usr/local/bundle
COPY --from=build --chown=rails:rails /rails /rails

# Run and own only the runtime files as a non-root user for security
RUN useradd rails --create-home --shell /bin/bash
USER rails:rails

# Copy built artifacts: gems, application
COPY --from=build /usr/local/bundle /usr/local/bundle
COPY --from=build --chown=rails:rails /rails /rails

CMD bundle exec bin/rails server -p $PORT -b 0.0.0.0

0 comments on commit 2d14513

Please sign in to comment.