Skip to content

Instantly share code, notes, and snippets.

@jkeam
Created September 22, 2023 15:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jkeam/b0f57a93c3769fe6f2e3894deaed251d to your computer and use it in GitHub Desktop.
Save jkeam/b0f57a93c3769fe6f2e3894deaed251d to your computer and use it in GitHub Desktop.
Dockerfile to build a Universal Developer Image for Dev Spaces to include Ruby and Rails
FROM quay.io/devfile/universal-developer-image:latest
# The following commands require root
USER 0
# Install a recent version of ruby
ENV RUBY_VERSION 3.1.2
RUN dnf -y update && \
dnf -y install rbenv ruby-build sqlite && \
dnf -y clean all --enablerepo='*' && \
rbenv install $RUBY_VERSION && \
rbenv global $RUBY_VERSION && \
echo 'eval "$(rbenv init - bash)"' >> $HOME/.bashrc && \
echo 'eval "$(rbenv init - sh)"' > /etc/profile.d/rbenv.sh
ENV PATH="${HOME}/.rbenv/shims:${PATH}" ENV="/etc/profile"
# Install rails
RUN gem install rails
# Set bundle config
RUN bundle config --global path $HOME/.bundle/vendor && \
chgrp -R 0 $HOME/.bundle && chmod -R g=u $HOME/.bundle && \
chgrp -R 0 $HOME/.local && chmod -R g=u $HOME/.local && \
chgrp -R 0 $HOME/.rbenv && chmod -R g=u $HOME/.rbenv
USER 10001
@jkeam
Copy link
Author

jkeam commented Sep 22, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment