Ruby runtime Dockerfile for trusted automated Docker builds.
This repository contains Dockerfile of Ruby runtime for Docker’s automated build published to the public Docker Hub Registry.
This image is a base image that makes it easy to dockerize standard Rack application.
It can automatically bundle a Rack application and its dependencies with a single line Dockerfile.
This project heavily borrowed code from Google’s google/ruby-runtime Docker image.
Install Docker.
Download automated build from public Docker Hub Registry: docker pull dockerfile/ruby-runtime
(alternatively, you can build an image from Dockerfile: docker build -t="dockerfile/ruby-runtime" github.com/dockerfile/ruby-runtime)
This image assumes that your application:
Gemfile and its corresponding Gemfile.lock for bundler, and the Gemfile contains Rack.config.ru for Rack.8080.When building your application docker image, ONBUILD triggers
Gemfile and leverage docker caching appropriately./app directory in the container.The image uses WEBrick as the application server by default. You can overwrite it by adding mongrel/thin/puma to Gemfile and configuring in your Dockerfile like:
ENV APPSERVER puma
Or you can just overwrite CMD in your Dockerfile like:
CMD ["bundle", "exec", "unicorn", "-c", "unicorn.conf", "config.ru"]
Rack application directory with the following content: FROM dockerfile/ruby-runtime
docker build -t="app" .
8080: APP=$(docker run -d -p 8080 app)
PORT=$(docker port $APP 8080 | awk -F: '{print $2}')
echo "Open http://localhost:$PORT/"