Sign inSign up

adambonsu/ruby

By adambonsu

•Updated about 7 years ago

Ruby environment

Image
0

327

adambonsu/ruby repository overview

⁠How to use this image

⁠Create a Dockerfile in your Ruby app project

FROM adambonsu/ruby:2.6

WORKDIR /usr/src/app

COPY Gemfile Gemfile.lock ./
RUN bundle install
COPY . .
RUN chmod +x ./your-daemon-or-script.rb

CMD ["./your-daemon-or-script.rb"]

Put this file in the root of your app, next to the Gemfile.

You can then build and run the Ruby image:

docker build -t my-ruby-app .
docker run -it --name my-running-script my-ruby-app

⁠Run a single Ruby script

For many simple, single file projects, you may find it inconvenient to write a complete Dockerfile. In such cases, you can run a Ruby script by using the Ruby Docker image directly:

docker container run --rm -v $(pwd):/home adambonsu/ruby:2.6 ./your-daemon-or-script.rb

⁠Run in interactive mode

If you want to interact with the ruby environment, you can do so by running a container without any arguments, or by specifying a shell:

docker container run -it --rm -v $(pwd):/home adambonsu/ruby:2.6

or

docker container run -it --rm -v $(pwd):/home adambonsu/ruby:2.6 bash

⁠Image Variants

The ruby image has several ruby versions

ruby:<version>

This image is based on the official Ruby project⁠ alpine image. Alpine Linux is much smaller than most distribution base images (~5MB), and thus leads to much slimmer images in general.

⁠License

View license information⁠ for the software contained in this image.

As with all Docker images, these likely also contain other software which may be under other licenses (such as Bash, etc from the base distribution, along with any direct or indirect dependencies of the primary software being contained).

Some additional license information which was able to be auto-detected might be found in the repo-info repository's ruby/ directory⁠.

As for any pre-built image usage, it is the image user's responsibility to ensure that any use of this image complies with any relevant licenses for all software contained within.

Tag summary

Content type

Image

Digest

Size

86.9 MB

Last updated

about 7 years ago

docker pull adambonsu/ruby:2.6