Skip to content

Instantly share code, notes, and snippets.

@FnTm
Created March 31, 2020 07:23
Show Gist options
  • Save FnTm/9eacb3182c40a1c15635ffca582bbb53 to your computer and use it in GitHub Desktop.
Save FnTm/9eacb3182c40a1c15635ffca582bbb53 to your computer and use it in GitHub Desktop.
Installing ruby via rbenv inside Debian Docker image
#jnlp-slave is based on slave, which in turn is based on scm-stretch debian 9.8
FROM jenkins/jnlp-slave:latest-jdk11
USER jenkins
# ==== Everything above this line is just to set an example context. Meaning - not important ====
# Install Local ruby
RUN git clone https://github.com/rbenv/rbenv.git ~/.rbenv \
&& echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc \
&& echo 'eval "$(rbenv init -)"' >> ~/.bashrc
ENV HOME /home/jenkins
ENV PATH "$HOME/.rbenv/bin:$HOME/.rbenv/shims:$PATH"
ENV RUBY_VERSION 2.6.3
RUN mkdir -p "$(rbenv root)"/plugins \
&& git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build
RUN rbenv install $RUBY_VERSION
RUN rbenv global $RUBY_VERSION && rbenv versions && ruby -v
# RUN curl -fsSL https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-doctor | bash # Uncomment this to get rbenv to validate your setup.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment