Last active
May 27, 2021 15:21
-
-
Save sandys/66f16b60110d32fb7351 to your computer and use it in GitHub Desktop.
Dockerfile for a ruby/rbenv setup on ubuntu/debian
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
# DOCKER-VERSION 1.0 | |
# run with curl <gist path> | docker build -t sandys/rbenv - | |
#when exiting/stopping a container it remains in the filesystem | |
#every time we run docker run a new container is created | |
#https://github.com/dotcloud/docker/issues/3258 | |
#stop all containers docker stop $(docker ps -a -q) | |
#rm all containers docker rm $(docker ps -a -q) | |
FROM debian:wheezy | |
MAINTAINER Sandeep Srinivasa "sandys@gmail.com" | |
RUN echo "deb http://mirrors.service.networklayer.com/debian wheezy main contrib non-free" > /etc/apt/sources.list | |
RUN echo "deb-src http://mirrors.service.networklayer.com/debian wheezy main contrib non-free" >> /etc/apt/sources.list | |
RUN echo "deb http://mirrors.service.networklayer.com/debian-security wheezy/updates main contrib non-free" >> /etc/apt/sources.list | |
RUN echo "deb-src http://mirrors.service.networklayer.com/debian-security wheezy/updates main contrib non-free" >> /etc/apt/sources.list | |
RUN echo "deb http://mirrors.service.networklayer.com/debian wheezy-backports main non-free contrib" >> /etc/apt/sources.list | |
RUN apt-get -y update | |
RUN apt-get -y install python-software-properties | |
RUN apt-get -y install build-essential libreadline-dev libssl-dev zlib1g-dev libxml2-dev libxslt-dev git libpq-dev libmysqlclient-dev libpq-dev nodejs libcurl4-openssl-dev libffi-dev imagemagick libjpeg-progs pngcrush | |
# install essentials | |
RUN apt-get -y install zsh build-essential curl wget | |
RUN apt-get install -y -q git | |
RUN add-apt-repository -y ppa:chris-lea/nginx-devel | |
RUN apt-get install -y -q nginx-full | |
# Install rbenv | |
RUN git clone https://github.com/sstephenson/rbenv.git /usr/local/rbenv | |
RUN echo '# rbenv setup' > /etc/profile.d/rbenv.sh | |
RUN echo 'export RBENV_ROOT=/usr/local/rbenv' >> /etc/profile.d/rbenv.sh | |
RUN echo 'export PATH="$RBENV_ROOT/bin:$PATH"' >> /etc/profile.d/rbenv.sh | |
RUN echo 'eval "$(rbenv init -)"' >> /etc/profile.d/rbenv.sh | |
RUN chmod +x /etc/profile.d/rbenv.sh | |
# install ruby-build | |
RUN mkdir /usr/local/rbenv/plugins | |
RUN git clone https://github.com/sstephenson/ruby-build.git /usr/local/rbenv/plugins/ruby-build | |
ENV RBENV_ROOT /usr/local/rbenv | |
ENV PATH $RBENV_ROOT/bin:$RBENV_ROOT/shims:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin | |
# does not work. PATH is set to | |
# $RBENV_ROOT/shims:$RBENV_ROOT/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin | |
ENV RUBY_CONFIGURE_OPTS --with-readline-dir="/usr/lib/x86_64-linux-gnu/libreadline.so" | |
# install ruby2 | |
#RUN zsh | |
RUN rbenv install 2.1.1 | |
RUN rbenv global 2.1.1 | |
RUN useradd -d /home/deployer -m -s /bin/bash deployer | |
RUN echo deployer:deployer123 | chpasswd | |
RUN rbenv global 2.1.1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment