Created
April 13, 2018 18:39
-
-
Save malovme/ad28917f1d86fac20b9c2634fbd0a048 to your computer and use it in GitHub Desktop.
Dockerfile to build image with ruby via rvm on ubuntu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:16.04 | |
# Using rvm inside docker is bad practice (docker anti-pattern) https://stackoverflow.com/a/41925488/3292174 | |
RUN apt-get update && apt-get install -y openssl curl | |
# rvm | |
RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB | |
RUN \curl -L https://get.rvm.io | bash -s stable | |
# ruby | |
RUN bash -c -l 'rvm install ruby-x.x.x' | |
# bundler | |
RUN bash -c -l 'gem install bundler --no-ri --no-rdoc' | |
# You can build docker image with: | |
# `cd /path/to/this/Dockerfile` | |
# `docker build -t rvm_ruby .` | |
# Start docker container with interactive bash: | |
# `docker run -it rvm_ruby bash` | |
# Inside container: | |
# `bash -l` | |
# `ruby -e "puts RUBY_VERSION"` |
You can read more here
This is the equivalent to executing bash to login, and then reading the following string as an execution to perform within bash.
bash -c -l 'rvm install ruby-x.x.x'
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
what does -l and -c command stands for?