This docker image is used to create and develop ruby programs.
1.2K
This docker image is used to create and develop ruby programs. It will install gems under project directory, so you can edit gems outside of container.
This image depends on official ruby image, so image tag also correspond to it.
| tag | link |
|---|---|
| latest | master/Dockerfile |
| 2.3-slim | 2.3-slim/Dockerfile |
| 2.3-alpine | 2.3-alpine/Dockerfile |
You can just use this image, but if you are using gems that depends on some packages, you have to create another Dockerfile. Below is just a sample.
FROM ytakagi/ruby:latest
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
libpq-dev \
nodejs \
&& rm -rf /var/lib/apt/lists/* \
&& ln -s /usr/bin/nodejs /usr/bin/node
Create Gemfile
cd /path/to/project/
touch Gemfile
Edit Gemfile to be below.
source 'https://rubygems.org'
gem 'rails'
Create Dockerfile and build
Create the same Dockerfile shown at Setup section.
docker build -t sample-image .
Bundle install and Rails new
docker run --rm -v $(pwd):/workdir sample-image bundle install
docker run --rm -v $(pwd):/workdir sample-image bundle exec rails new . --force --database=postgresql --skip-bundle
It's done!!
Note: you need to prepare other container such as database separately.
cd /path/to/project/
docker run -v $(pwd):/workdir sample-image bundle exec rails server
Now you can edit Rails program (also gem) from host machine, while running Rails server at container.
Sweet!!
Content type
Image
Digest
Size
265.3 MB
Last updated
almost 10 years ago
docker pull ytakagi/ruby