Skip to content

Instantly share code, notes, and snippets.

@soplana
Created September 2, 2014 07:36
Show Gist options
  • Select an option

  • Save soplana/eb77e1680ec6c5ed00bb to your computer and use it in GitHub Desktop.

Select an option

Save soplana/eb77e1680ec6c5ed00bb to your computer and use it in GitHub Desktop.
rails開発用
FROM ubuntu
MAINTAINER soplana "[email protected]"
# turn on universe packages
RUN apt-get update
# basics
RUN apt-get install -y nginx openssh-server git-core openssh-client curl
RUN apt-get install -y nano
RUN apt-get install -y vim
RUN apt-get install -y build-essential
RUN apt-get install -y openssl libreadline6 libreadline6-dev curl zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion pkg-config
RUN apt-get install -y libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev
RUN apt-get install libpq-dev
RUN apt-get install -y imagemagick
RUN apt-get install -y default-jre-headless
RUN apt-get install -y lsof
# Redis
# redis-server /etc/redis/redis.conf
# EXPOSE 6379
RUN \
cd /tmp && \
wget http://download.redis.io/redis-stable.tar.gz && \
tar xvzf redis-stable.tar.gz && \
cd redis-stable && \
make && \
make install && \
cp -f src/redis-sentinel /usr/local/bin && \
mkdir -p /etc/redis && \
cp -f *.conf /etc/redis && \
rm -rf /tmp/redis-stable* && \
sed -i 's/^\(bind .*\)$/# \1/' /etc/redis/redis.conf && \
sed -i 's/^\(daemonize .*\)$/# \1/' /etc/redis/redis.conf && \
sed -i 's/^\(dir .*\)$/# \1\ndir \/data/' /etc/redis/redis.conf && \
sed -i 's/^\(logfile .*\)$/# \1/' /etc/redis/redis.conf && \
mkdir /data
# memcached
# /usr/local/memcached/bin/memcached -u daemon
# EXPOSE 11211
RUN wget -q http://www.memcached.org/files/memcached-1.4.17.tar.gz -O /tmp/memcached.tar.gz && \
cd /tmp && \
tar xvfz memcached.tar.gz && \
cd memcached-1.4.17 && \
apt-get update && \
apt-get install libevent-dev -y && \
./configure --prefix=/usr/local/memcached && \
make && \
make install && \
cd .. && rm -rf memcached* && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /tmp/* && \
apt-get autoremove && \
apt-get clean
# Add User
RUN adduser --disabled-password --gecos "" dev \
&& echo "dev ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers \
&& echo 'dev:dev' | chpasswd
# User Setup
USER dev
WORKDIR /home/dev
ENV HOME /home/dev
RUN sudo apt-get update
# 日本語化
RUN sudo apt-get install -y language-pack-ja
RUN sudo dpkg-reconfigure locales
RUN sudo update-locale LANG=ja_JP.UTF-8
# RUN echo -eと書くと-eオプションが-eごと挿入されてしまう...
RUN /bin/bash -l -c "echo -e 'export LC_MESSAGES=ja_JP.UTF-8\nexport LC_IDENTIFICATION=ja_JP.UTF-8\nexport LC_COLLATE=ja_JP.UTF-8\nexport LANG=ja_JP.UTF-8\nexport LC_MEASUREMENT=ja_JP.UTF-8\nexport LC_CTYPE=ja_JP.UTF-8\nexport LC_TIME=ja_JP.UTF-8\nexport LC_NAME=ja_JP.UTF-8' >> ~/.bashrc"
# mysql
# sudo service mysql start
# EXPOSE 3306
RUN sudo apt-get install -y mysql-server
RUN sudo apt-get install -y libmysqld-dev
RUN sudo apt-get clean
# postgres
# sudo /etc/init.d/postgresql start
# $ sudo find / -name pg* | grep pg_hba
# $ sudo vim /etc/postgresql/9.3/main/pg_hba.conf
# local all all trust
# host all all 127.0.0.1/32 trust
# host all all ::1/128 trust
# $ sudo -u postgres psql postgres
RUN sudo apt-get install -y postgresql postgresql-contrib
RUN sudo -u postgres createuser dev
# mongodb
# sudo mongod --dbpath ~/data/db
# Expose ports.
# - 27017: process
# - 28017: http
# EXPOSE 27017
# EXPOSE 28017
RUN sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10 \
&& echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | \
sudo tee /etc/apt/sources.list.d/mongodb.list \
&& sudo apt-get update \
&& sudo apt-get install -y mongodb-org \
&& mkdir -p ~/data/db
# heroku
RUN wget -qO- https://toolbelt.heroku.com/install-ubuntu.sh | sh
# vim/NeoBundle
RUN mkdir -p ~/.vim/bundle
RUN git clone https://github.com/Shougo/neobundle.vim ~/.vim/bundle/neobundle.vim
RUN /bin/bash -l -c "echo -e \"if has('vim_starting')\n set runtimepath+=~/.vim/bundle/neobundle.vim/\nendif\ncall neobundle#rc(expand('~/.vim/bundle/'))\nNeoBundleFetch 'Shougo/neobundle.vim'\nfiletype plugin on\nNeoBundleCheck\" > ~/.vimrc"
# vim default editor
RUN git config --global core.editor 'vim -c "set fenc=utf-8"'
# tmux
RUN sudo apt-get install -y tmux
# install RVM, Ruby, and Bundler
RUN \curl -L https://get.rvm.io | bash -s stable
RUN echo 'source "$HOME/.rvm/scripts/rvm"' >> ~/.bashrc
RUN /bin/bash -l -c "rvm requirements"
RUN /bin/bash -l -c "rvm install 2.1.1"
RUN /bin/bash -l -c "gem install bundler"
RUN /bin/bash -l -c "gem install rails"
# ports
EXPOSE 22 80 3000 3001
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment