Skip to content

Commit

Permalink
Fix $PATH variable in login shell (#25)
Browse files Browse the repository at this point in the history
Co-authored-by: Andrey Novikov <envek@envek.name>
  • Loading branch information
OuYangJinTing and Envek committed May 30, 2023
1 parent 00b3eca commit 8f0ab91
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Expand Up @@ -33,5 +33,7 @@ ENV BUNDLE_PATH="$GEM_HOME" \

# path recommendation: https://github.com/bundler/bundler/pull/6469#issuecomment-383235438
ENV PATH $GEM_HOME/bin:$BUNDLE_PATH/gems/bin:/usr/lib/fullstaq-ruby/versions/${RUBY_VERSION}/bin:$PATH
# Make login shell (bash -l) to have the same path as regular one.
RUN echo 'PATH=$GEM_HOME/bin:$BUNDLE_PATH/gems/bin:/usr/lib/fullstaq-ruby/versions/${RUBY_VERSION}/bin:$PATH' >> /etc/profile.d/fullstaq-ruby.sh

CMD [ "irb" ]
10 changes: 0 additions & 10 deletions README.md
Expand Up @@ -87,16 +87,6 @@ For Ruby 3.0 and older, short aliases for latest patch versions are made against

Ruby is installed from official APT package repository. Rbenv isn't used.

## Caveats

Bash login shell `bash -l -c 'command'` resets `$PATH` to default. It is not clear why it happens there, because in official Ruby image it works and this image is based on the same `debian:stretch-slim` base image.

That may hurt you if you're using `whenever` gem which wraps every command in Bash login shell by default. To remove this wrapping place following to the top of your `config/schedule.rb`:

```ruby
# config/schedule.rb
set :job_template, nil
```

[Fullstaq Ruby]: https://fullstaqruby.org/ "Ruby, optimized for production"
[Hongli Lai]: https://www.joyfulbikeshedding.com/
Expand Down

0 comments on commit 8f0ab91

Please sign in to comment.