Image on Docker Hub: https://hub.docker.com/r/fnproject/ruby
docker run --rm -v "$PWD":/worker -w /worker fnproject/ruby:dev bundle install --standalone --cleanIf you're using Nokogiri, use this one:
docker run --rm -v "$PWD":/worker -w /worker fnproject/ruby:dev sh -c 'bundle config --local build.nokogiri --use-system-libraries && bundle install --standalone --clean'Then require the vendored gems. Notice in hello.rb, we add the following so it uses the vendored gems:
require_relative 'bundle/bundler/setup'Test your code:
docker run --rm -it -v $PWD:/app -w /app fnproject/ruby ruby hello.rbNotice we're using fnproject/ruby:dev to build and fnproject/ruby to run. fnproject/ruby is much smaller.
Make a Dockerfile:
FROM fnproject/ruby
WORKDIR /app
ADD . /app
ENTRYPOINT ["ruby", "hello.rb"]
Build the image:
docker build -t username/imagename:latest .Push it to Docker Hub:
docker push username/imagename