LoginSignup
5
6

More than 5 years have passed since last update.

Docker で Ruby 開発環境

Last updated at Posted at 2016-04-17

Dockerfile 作成

$ mkdir test
$ cd test
$ vim Dockerfile
Dockerfile
FROM polleverywhere/rbenv

ENV RUBY_VERSION 2.1.3

RUN apt-get update -q \
  && apt-get -q -y install autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libmysqlclient-dev mysql-client \
  && rbenv install $RUBY_VERSION \
  && rbenv global $RUBY_VERSION \
  && apt-get purge -y -q autoconf bison build-essential libssl-dev zlib1g-dev \
  && apt-get autoremove -y \
  && rm -rf /var/lib/apt/lists

RUN gem install --no-ri --no-rdoc bundler
RUN rbenv rehash

イメージのビルド

$ docker build -t y-okubo/rails-server:latest .

コンテナの作成と実行

$ docker run --name mywebapp  -v /Users/y-okubo:/y-okubo --link mydb:mysql -p 8080:80 -it y-okubo/rails-server
5
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
6