Skip to content

Instantly share code, notes, and snippets.

@164c
Created February 5, 2016 07:51
Show Gist options
  • Save 164c/ec9a9efb70ceac89fd5f to your computer and use it in GitHub Desktop.
Save 164c/ec9a9efb70ceac89fd5f to your computer and use it in GitHub Desktop.
CentOS6.xでRuby2.1.5でRailsが動きそうなDockerfile
FROM centos:6
MAINTAINER 164c <morotomi.hiroshi@gmail.com>
RUN yum clean all && yum update -y && yum install -y \
openssh \
openssh-clients \
openssh-server \
passwd \
sudo \
git \
tar \
gcc \
make \
libffi-devel \
zlib-devel \
openssl-devel \
ruby \
gcc-c++ \
readline-devel \
bzip2 \
ImageMagick \
ImageMagick-devel \
patch \
v8
RUN yum install -y http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
RUN yum install -y mysql mysql-devel mysql-server mysql-utilities
RUN git clone git://github.com/sstephenson/rbenv.git /usr/local/src/rbenv
RUN echo 'export RBENV_ROOT="/usr/local/src/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 source /etc/profile.d/rbenv.sh
RUN ["/bin/bash", "-c","git clone git://github.com/sstephenson/ruby-build.git /usr/local/src/rbenv/plugins/ruby-build"]
RUN ["/bin/bash", "-c","source /etc/profile.d/rbenv.sh && /usr/local/src/rbenv/bin/rbenv install 2.1.5 && /usr/local/src/rbenv/bin/rbenv global 2.1.5"]
RUN ["/bin/bash", "-c","source /etc/profile.d/rbenv.sh && gem update --system"]
RUN ["/bin/bash", "-c","source /etc/profile.d/rbenv.sh && gem install bundler"]
RUN useradd centos
RUN mkdir /home/centos/.ssh
RUN curl https://github.com/164c.keys >> /home/centos/.ssh/authorized_keys
RUN chown -R centos /home/centos/.ssh
RUN chmod 700 /home/centos/.ssh && chmod 600 /home/centos/.ssh/authorized_keys
RUN echo "centos ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/centos
# to generate keys which are required to ssh login
# https://access.redhat.com/documentation/ja-JP/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/s1-ssh-configuration.html#table-ssh-configuration-configs-system
RUN /usr/bin/ssh-keygen -t rsa -b 2048 -f /etc/ssh/ssh_host_rsa_key -N ""
EXPOSE 22 80 3306
ENTRYPOINT ["/sbin/init"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment