Skip to content

Commit

Permalink
Gotta make the user before we chown things to it
Browse files Browse the repository at this point in the history
  • Loading branch information
nbudin committed Sep 11, 2023
1 parent aa00920 commit 38d134c
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 @@ -40,13 +40,13 @@ RUN apt-get update -qq && \
apt-get install --no-install-recommends -y libpq5 libmagickcore-6.q16-6 && \
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

EXPOSE 3000
CMD bundle exec rails server -b 0.0.0.0 -p $PORT

0 comments on commit 38d134c

Please sign in to comment.