Ruby
Comprehensive information about Ruby app configuration.
Common Settings
The section outlines common settings and behaviours for Ruby projects.
Ruby Version
The Ruby version is automatically detected from .ruby-version file in the root
directory of your project and the appropriate image is selected according to it.
To use a different version of Ruby other than the default, create a
.ruby-version file and add the version to it. Example,
3.4.4Ensure you use a version supported by docker ruby image.
Ruby on Rails
Rails builds on Viduli use separate build and run images.
- Base distribution: Debian 12 Bookworm Slim
- Default Ruby version: 3.4.4
- Default image:
- Build:
ruby:3.4.4-slim-bookworm - Runtime:
ruby:3.4.4-slim-bookworm
- Build:
- Included packages:
- Base:
curl libjemalloc2 libvips sqlite3 - Build:
build-essential git libyaml-dev pkg-config
- Base:
- Default port: 3000
Build dependencies
Dependencies are installed using Bundler. The build process:
- Installs application gems from
Gemfile - Precompiles bootsnap code for faster boot times
- Precompiles assets for production (using a dummy
SECRET_KEY_BASE)
Build command
No explicit build command is run by default. Asset precompilation happens automatically during the build stage.
Runtime dependencies
Only production gems are included in the runtime image. Development and test dependencies are excluded.
Run command
The default is ./bin/rails server -b 0.0.0.0 -p 3000. It can be overridden
by providing the run command in the resource build configuration.
Environment
The following environment variables are set:
RAILS_ENV=production- Production environmentBUNDLE_DEPLOYMENT=1- Deployment modeBUNDLE_PATH=/usr/local/bundle- Bundle pathBUNDLE_WITHOUT=development- Exclude development gemsPORT=3000- Application port
If you set a RAILS_RELATIVE_URL_ROOT secret, it will be available as an
environment variable for Rails to use.
By default, PORT is set to 3000. If you set an expose port value in the
resource build configuration, PORT is set to that value.
Secrets added to the resource are also available in the environment during the image build and run stages.
Entrypoint
The entrypoint script enables jemalloc for reduced memory usage and latency.
Note: Unlike the default entrypoint provided by the rails project, Viduli's entry script does not prepare the database prior to running the Rails server.
Sinatra
Sinatra builds on Viduli use a single build and run image.
- Base distribution: Debian 12 Bookworm Slim
- Default Ruby version: 3.4.4
- Default image:
ruby:3.4.4-slim-bookworm - Included packages:
build-essential ca-certificates tzdata libffi-dev libyaml-dev - Default port: 4567
Build dependencies
Dependencies are installed using Bundler and gem install. The build process:
- Installs
sinatra,rackup,puma, andbundleras system gems - Configures bundler for deployment mode
- Installs gems from
Gemfileif it exists
Build command
No explicit build command is run by default.
Run command
The default is ruby ${APP_FILE} where APP_FILE defaults to app.rb. You
can override this by providing the run command in the resource build configuration.
Environment
The following environment variables are set:
APP_ENV=production- Production environmentAPP_FILE=app.rb- Application file
By default, PORT is set to 4567 (Sinatra's default). If you set an expose
port value in the resource build configuration, PORT is set to that
value.
Secrets added to the resource are also available in the environment during the image build and run stages.
Ruby (Generic)
The generic Ruby build option is suitable for deploying projects that are not
built using a supported Ruby framework. If your project uses a supported
framework such as Rails or Sinatra, please select that option when deploying
your project. By selecting the appropriate framework build, you get optimal
settings that are not available when selecting the generic ruby option.
- Base distribution: Debian 12 Bookworm Slim
- Default Ruby version: 3.4.4
- Default image:
ruby:3.4.4-slim-bookworm - Included packages:
build-essential ca-certificates tzdata libffi-dev libyaml-dev - Default port: 3000
Build dependencies
Dependencies should be installed via your custom install command or using Bundler/Gemfile if present.
Build command
No explicit build command is run by default. You can set a custom build command in the resource build configuration.
Run command
You must provide a run command in the resource build configuration.
Environment
By default, PORT is set to 3000. If you set an expose port value in the
resource build configuration, PORT is set to that value.
Secrets added to the resource are also available in the environment during the image build and run stages.