Skip to content

Instantly share code, notes, and snippets.

@upinetree
Created November 3, 2016 08:31
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 upinetree/40ec52cd551d6b237edfb17c9533cdee to your computer and use it in GitHub Desktop.
Save upinetree/40ec52cd551d6b237edfb17c9533cdee to your computer and use it in GitHub Desktop.
Use rbenv on ubuntu (memo for the case that could not use a ruby image for some reason)
FROM ubuntu
# prepare packages
RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y git \
&& apt-get build-dep -y ruby
# set timezone
RUN echo "Asia/Tokyo" > /etc/timezone \
&& dpkg-reconfigure -f noninteractive tzdata
# set locale
RUN /usr/sbin/locale-gen ja_JP.UTF-8
# add login user
RUN useradd -m -G sudo ubuntu
USER ubuntu
# install rbenv
RUN git clone https://github.com/rbenv/rbenv.git ~/.rbenv \
&& git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build \
&& echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile \
&& echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
# install ruby
RUN bash -l -c "rbenv install 2.3.1"
EXPOSE 80
CMD ["echo", "hello"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment