shimgo
7/24/2016 - 9:17 AM

開発環境を構築するDockerfileのサンプル

開発環境を構築するDockerfileのサンプル

FROM centos:7

ENV HOME /root

RUN set -x \
    # Packages
    && yum -y update \
    && yum -y install \
        bzip2 \
        gcc-c++ \
        git \
        glibc-headers \
        libffi-devel \
        libxml2-devel \
        libxslt-devel \
        libyaml-devel \
        lua \
        lua-devel \
        make \
        ncurses-devel \
        net-tools \
        openssl-devel \
        patch \
        perl \
        perl-devel \
        perl-ExtUtils-CBuilder \
        perl-ExtUtils-Embed \
        perl-ExtUtils-ParseXS \
        python \
        python-devel \
        readline \
        readline-devel \
        ruby-devel \
        sqlite-devel \
        sudo \
        tar \
        tcl-devel \
        wget \
        zlib \
        zlib-devel \
        zsh \
    # Python3 
    && yum -y install \
        epel-release \
    && yum -y install \
        python34 \        
        python34-devel \
    && ln -s /usr/bin/python3.4 /usr/local/bin/python \
    # user
    && echo 'root:root' |chpasswd \
    && useradd -m developer \
    && echo "developer ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers \
    && echo 'developer:developer' | chpasswd \
    && chsh -s /usr/bin/zsh developer \
    # vim
    && git clone https://github.com/vim/vim.git /tmp/vim \
    && cd /tmp/vim \
    && ./configure \
        --with-features=huge \
        --enable-multibyte \
        --enable-xim \
        --enable-fontset \
        --enable-perlinterp \
        --enable-python3interp \
        --with-python3-config-dir=/usr/lib64/python3.4/config-3.4m \
        --enable-rubyinterp \
        --enable-luainterp \
        --enable-fail-if-missing \
        --enable-pythoninterp \
        --with-python-config-dir=/usr/lib64/python2.7/config \
    && make \
    && make install \
    ## Python(virtualenv)
    && set -x \
    && cd /tmp \
    && wget https://bootstrap.pypa.io/get-pip.py \
    && python get-pip.py \
    && pip install virtualenv virtualenvwrapper \
    # Python (pyenv)
    && git clone https://github.com/yyuu/pyenv.git /opt/pyenv \
    && ln -s /opt/pyenv/bin/pyenv /usr/local/bin/pyenv \
    && echo 'export PYENV_ROOT=/opt/pyenv' >> /etc/profile.d/pyenv.sh \
    && echo 'eval "$(pyenv init -)"' >> /etc/profile.d/pyenv.sh \
    && chmod +x /etc/profile.d/pyenv.sh \
    && source ~/.bashrc \
    && pyenv install 3.5.1 \
    && pyenv install 2.7.11 \
    # Ruby(rbenv)
    && git clone https://github.com/sstephenson/rbenv.git /opt/rbenv \
    && ln -s /opt/rbenv/bin/rbenv /usr/local/bin/rbenv \
    && echo 'export RBENV_ROOT=/opt/rbenv' >> /etc/profile.d/rbenv.sh \
    && echo 'eval "$(rbenv init -)"' >> /etc/profile.d/rbenv.sh \
    && chmod +x /etc/profile.d/rbenv.sh \
    && source ~/.bashrc \
    && git clone https://github.com/sstephenson/ruby-build.git /opt/rbenv/plugins/ruby-build \
    && CONFIGURE_OPTS="--disable-install-rdoc" MAKE_OPTS="-j4" rbenv install -v 2.2.0 \
    && rbenv rehash \
    && rbenv global 2.2.0
USER developer
WORKDIR /home/developer
ENV HOME /home/developer
RUN set -x \
    # dotfiles
    && git clone https://github.com/shin-m/dotfiles.git ~/dotfiles \
    && make -C ~/dotfiles deploy \
    # powerline-status
    && pip install --user powerline-status \
    # oh-my-zsh
    && git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh