Skip to content

erikap/docker-ruby-sinatra

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ruby Sinatra docker

Docker for hosting Sinatra apps

Running your Sinatra app

docker run --name my-sinatra-app \
    -p 80:80 \
    -v /path/to/sinatra/app:/usr/src/app \
    -d erikap/ruby-sinatra

The Docker image exposes port 80.

The Ruby source code is mounted in /usr/src/app. The main Sinatra file is configured at container start up via the MAIN_APP_FILE environment variable. If not set, it defaults to web.rb.

Dependencies can be installed through Bundler by providing a Gemfile. The Sinatra gem is installed by default. The environment can be set via the RACK_ENV environment variable. If not set, it defaults to production.

The image uses Sinatra Reloader for automatic reload. To enable the reload, add the following line in your MAIN_APP_FILE

require 'sinatra/reloader' if development?

To ensure that stopping of the container happens instantly, start docker with the --init option or use init: true when using a docker-compose.yml file.

About

Docker for hosting Sinatra apps

Resources

License

Stars

Watchers

Forks

Packages

No packages published