From fb970c1d37a8fe9527a62f258405fcadd4504c6b Mon Sep 17 00:00:00 2001 From: Luiz Eduardo Kowalski Date: Thu, 25 Dec 2025 11:58:53 +0100 Subject: [PATCH 1/2] feature: ability to use Docker hardened image --- DEMO.md | 2 +- README.md | 3 +- lib/generators/dockerfile_generator.rb | 8 +++ lib/generators/templates/Dockerfile.erb | 2 + test/results/hardened/Dockerfile | 71 +++++++++++++++++++++++++ test/test_hardened.rb | 16 ++++++ 6 files changed, 100 insertions(+), 2 deletions(-) create mode 100644 test/results/hardened/Dockerfile create mode 100644 test/test_hardened.rb diff --git a/DEMO.md b/DEMO.md index f45f6cc..3898c37 100644 --- a/DEMO.md +++ b/DEMO.md @@ -190,7 +190,7 @@ docker buildx build . -t rails-demo docker run -p 3000:3000 -e RAILS_MASTER_KEY=$(cat config/master.key) --rm rails-demo ``` -# Demo 5 - Bunding Javascript (esbuild) +# Demo 5 - Bundling Javascript (esbuild) While optional, bundling Javascript is a popular choice, and starting with Rails 7 there are three options: esbuild, rollup, and webpack. The diff --git a/README.md b/README.md index cf1f29e..3e56f65 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,7 @@ different contents. If both are specified, `--force` takes precedence. * `--alpine` - use [alpine](https://www.alpinelinux.org/) as base image (requires [Alpine <= 3.18 OR Rails >= 8.0](https://github.com/sparklemotion/sqlite3-ruby/issues/434)) * `--fullstaq` - use [fullstaq](https://fullstaqruby.org/) [images](https://github.com/evilmartians/fullstaq-ruby-docker) on [quay.io](https://quay.io/repository/evl.ms/fullstaq-ruby?tab=tags&tag=latest) +* `--hardened` - use `dhi.io/ruby:$RUBY_VERSION-dev` as base image (mutually exclusive with `--alpine` or `--fullstaq`) * `--jemalloc` - use [jemalloc](https://jemalloc.net/) memory allocator * `--swap=n` - allocate swap space. See [falloc options](https://man7.org/linux/man-pages/man1/fallocate.1.html#OPTIONS) for suffixes * `--yjit` - enable [YJIT](https://github.com/ruby/ruby/blob/master/doc/yjit/yjit.md) optimizing compiler @@ -50,7 +51,7 @@ different contents. If both are specified, `--force` takes precedence. * `--ci` - include test gems in deployed image * `--compose` - generate a `docker-compose.yml` file -* `--max-idle=n` - exit afer *n* seconds of inactivity. Supports [iso 8601](https://en.wikipedia.org/wiki/ISO_8601#Durations) and [sleep](https://man7.org/linux/man-pages/man1/sleep.1.html#DESCRIPTION) syntaxes. Uses passenger for now, awaiting [puma](https://github.com/puma/puma/issues/2580) support. +* `--max-idle=n` - exit after *n* seconds of inactivity. Supports [iso 8601](https://en.wikipedia.org/wiki/ISO_8601#Durations) and [sleep](https://man7.org/linux/man-pages/man1/sleep.1.html#DESCRIPTION) syntaxes. Uses passenger for now, awaiting [puma](https://github.com/puma/puma/issues/2580) support. * `--nginx` - serve static files via [nginx](https://www.nginx.com/). May require `--root` on some targets to access `/dev/stdout` * `--thruster` - serve static files via [thruster](https://github.com/basecamp/thruster?tab=readme-ov-file#thruster). * `--link` - add [--link](https://docs.docker.com/engine/reference/builder/#copy---link) to COPY statements. Some tools (like at the moment, [buildah](https://www.redhat.com/en/topics/containers/what-is-buildah)) don't yet support this feature. diff --git a/lib/generators/dockerfile_generator.rb b/lib/generators/dockerfile_generator.rb index afa45f7..bb47942 100644 --- a/lib/generators/dockerfile_generator.rb +++ b/lib/generators/dockerfile_generator.rb @@ -16,6 +16,7 @@ class DockerfileGenerator < Rails::Generators::Base "compose" => false, "fullstaq" => false, "gemfile-updates" => true, + "hardened" => false, "jemalloc" => true, "label" => {}, "link" => false, @@ -200,6 +201,9 @@ class DockerfileGenerator < Rails::Generators::Base class_option :fullstaq, type: :boolean, default: OPTION_DEFAULTS.fullstaq, descr: "use Fullstaq Ruby image from Quay.io" + class_option :hardened, type: :boolean, default: OPTION_DEFAULTS.hardened, + desc: "use hardened Ruby image from dhi.io" + class_option :yjit, type: :boolean, default: OPTION_DEFAULTS.yjit, desc: "enable YJIT optimizing compiler" @@ -294,6 +298,10 @@ class DockerfileGenerator < Rails::Generators::Base def generate_app source_paths.push File.expand_path("./templates", __dir__) + if options.hardened? && (options.fullstaq? || options.alpine?) + raise Thor::Error, "--hardened is mutually exclusive with --fullstaq and --alpine" + end + # merge options options.label.replace(@@labels.merge(options.label).select { |key, value| value != "" }) diff --git a/lib/generators/templates/Dockerfile.erb b/lib/generators/templates/Dockerfile.erb index d4e3d81..d12df2b 100644 --- a/lib/generators/templates/Dockerfile.erb +++ b/lib/generators/templates/Dockerfile.erb @@ -18,6 +18,8 @@ ARG RUBY_VERSION=<%= RUBY_VERSION %> <% end -%> <% if options.fullstaq -%> FROM <%= platform %>quay.io/evl.ms/fullstaq-ruby:${RUBY_VERSION}-<%= options.jemalloc ? 'jemalloc-' : 'malloctrim-' %><%= variant %><% unless options.precompile == "defer" %> AS base<% end %> +<% elsif options.hardened -%> +FROM <%= platform %>dhi.io/ruby:$RUBY_VERSION-dev<% unless options.precompile == "defer" %> AS base<% end %> <% else -%> FROM <%= platform %><%= options.registry %>ruby:$RUBY_VERSION-<%= variant %><% unless options.precompile == "defer" %> AS base<% end %> <% end -%> diff --git a/test/results/hardened/Dockerfile b/test/results/hardened/Dockerfile new file mode 100644 index 0000000..7cc9d61 --- /dev/null +++ b/test/results/hardened/Dockerfile @@ -0,0 +1,71 @@ +# syntax=docker/dockerfile:1 +# check=error=true + +# Make sure RUBY_VERSION matches the Ruby version in .ruby-version +ARG RUBY_VERSION=xxx +FROM dhi.io/ruby:$RUBY_VERSION-dev AS base + +# Rails app lives here +WORKDIR /rails + +# Update gems and bundler +RUN gem update --system --no-document && \ + gem install -N bundler + +# Install base packages +RUN apt-get update -qq && \ + apt-get install --no-install-recommends -y curl libjemalloc2 sqlite3 && \ + rm -rf /var/lib/apt/lists /var/cache/apt/archives + +# Set production environment +ENV BUNDLE_DEPLOYMENT="1" \ + BUNDLE_PATH="/usr/local/bundle" \ + BUNDLE_WITHOUT="development:test" \ + RAILS_ENV="production" + + +# Throw-away build stage to reduce size of final image +FROM base AS build + +# Install packages needed to build gems +RUN apt-get update -qq && \ + apt-get install --no-install-recommends -y build-essential libyaml-dev pkg-config && \ + rm -rf /var/lib/apt/lists /var/cache/apt/archives + +# Install application gems +COPY Gemfile Gemfile.lock ./ +RUN bundle install && \ + rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git + +# Copy application code +COPY . . + +# Precompiling assets for production without requiring secret RAILS_MASTER_KEY +RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile + + +# Final stage for app image +FROM base + + +# Copy built artifacts: gems, application +COPY --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}" +COPY --from=build /rails /rails + +# Run and own only the runtime files as a non-root user for security +RUN groupadd --system --gid 1000 rails && \ + useradd rails --uid 1000 --gid 1000 --create-home --shell /bin/bash && \ + mkdir /data && \ + chown -R 1000:1000 db log storage tmp /data +USER 1000:1000 + +# Deployment options +ENV DATABASE_URL="sqlite3:///data/production.sqlite3" + +# Entrypoint prepares the database. +ENTRYPOINT ["/rails/bin/docker-entrypoint"] + +# Start the server by default, this can be overwritten at runtime +EXPOSE 3000 +VOLUME /data +CMD ["./bin/rails", "server"] diff --git a/test/test_hardened.rb b/test/test_hardened.rb new file mode 100644 index 0000000..acd28bd --- /dev/null +++ b/test/test_hardened.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +require_relative "base" +require "yaml" + +class TestHardened < TestBase + @rails_options = "--minimal" + @generate_options = "--hardened" + + def test_hardened + check_dockerfile + + options = YAML.load_file("config/dockerfile.yml")["options"] + assert_equal true, options["hardened"] + end +end From dda94ff9b69a4cdfb7ff63f3cf3298b114908fe5 Mon Sep 17 00:00:00 2001 From: Luiz Eduardo Kowalski Date: Thu, 25 Dec 2025 12:28:47 +0100 Subject: [PATCH 2/2] recapture tests due to libvips --- test/results/alpine/Dockerfile | 6 +++--- test/results/api/Dockerfile | 8 ++++++-- test/results/bun/Dockerfile | 8 ++++++-- test/results/cache/Dockerfile | 9 +++++++-- test/results/esbuild/Dockerfile | 8 ++++++-- test/results/execjs_importmap/Dockerfile | 8 ++++++-- test/results/execjs_node/Dockerfile | 8 ++++++-- test/results/litefs/Dockerfile | 6 +++--- test/results/litestream/Dockerfile | 8 ++++++-- test/results/mysql/Dockerfile | 8 ++++++-- test/results/parallel/Dockerfile | 8 ++++++-- test/results/postgresql/Dockerfile | 8 ++++++-- test/results/postgresql/database.yml | 2 +- test/results/precompile_defer/Dockerfile | 8 ++++++-- test/results/redis/Dockerfile | 8 ++++++-- test/results/sidekiq/Dockerfile | 8 ++++++-- test/results/solid_queue_postgres/Dockerfile | 8 ++++++-- test/results/solid_queue_sqlite3/Dockerfile | 8 ++++++-- test/results/solid_queue_sqlite3/puma.rb | 3 +-- test/results/sqlite3/Dockerfile | 8 ++++++-- test/results/thruster/Dockerfile | 8 ++++++-- test/results/trilogy/Dockerfile | 8 ++++++-- 22 files changed, 117 insertions(+), 45 deletions(-) diff --git a/test/results/alpine/Dockerfile b/test/results/alpine/Dockerfile index 4e84e87..da10d9e 100644 --- a/test/results/alpine/Dockerfile +++ b/test/results/alpine/Dockerfile @@ -19,7 +19,7 @@ RUN gem update --system --no-document && \ gem install -N bundler # Install base packages -RUN apk add --no-cache curl jemalloc postgresql-client tzdata +RUN apk add --no-cache curl jemalloc postgresql-client tzdata vips # Set production environment ENV BUNDLE_DEPLOYMENT="1" \ @@ -32,7 +32,7 @@ ENV BUNDLE_DEPLOYMENT="1" \ FROM base AS build # Install packages needed to build gems and node modules -RUN apk add --no-cache build-base gyp libpq-dev pkgconfig python3 yaml-dev +RUN apk add --no-cache build-base gyp libffi-dev libpq-dev pkgconfig python3 yaml-dev # Install JavaScript dependencies ARG NODE_VERSION=xxx @@ -68,7 +68,7 @@ RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile FROM base # Install packages needed for deployment -RUN apk add --no-cache libpq +RUN apk add --no-cache imagemagick libpq vips # Copy built artifacts: gems, application COPY --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}" diff --git a/test/results/api/Dockerfile b/test/results/api/Dockerfile index a81ab7c..3b2c6f7 100644 --- a/test/results/api/Dockerfile +++ b/test/results/api/Dockerfile @@ -37,7 +37,7 @@ RUN gem update --system --no-document && \ # Install base packages RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y curl libjemalloc2 sqlite3 && \ + apt-get install --no-install-recommends -y curl libjemalloc2 libvips sqlite3 && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Set production environment @@ -52,7 +52,7 @@ FROM base AS build # Install packages needed to build gems RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y build-essential libyaml-dev pkg-config && \ + apt-get install --no-install-recommends -y build-essential libffi-dev libyaml-dev pkg-config && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Install application gems @@ -71,6 +71,10 @@ RUN bundle exec bootsnap precompile app/ lib/ # Final stage for app image FROM base +# Install packages needed for deployment +RUN apt-get update -qq && \ + apt-get install --no-install-recommends -y imagemagick libvips && \ + rm -rf /var/lib/apt/lists /var/cache/apt/archives # Copy built artifacts: gems, application COPY --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}" diff --git a/test/results/bun/Dockerfile b/test/results/bun/Dockerfile index e56e16f..cd08250 100644 --- a/test/results/bun/Dockerfile +++ b/test/results/bun/Dockerfile @@ -20,7 +20,7 @@ RUN gem update --system --no-document && \ # Install base packages RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y curl libjemalloc2 sqlite3 && \ + apt-get install --no-install-recommends -y curl libjemalloc2 libvips sqlite3 && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Set production environment @@ -35,7 +35,7 @@ FROM base AS build # Install packages needed to build gems RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y build-essential libyaml-dev pkg-config unzip && \ + apt-get install --no-install-recommends -y build-essential libffi-dev libyaml-dev pkg-config unzip && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Install Bun @@ -67,6 +67,10 @@ RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile # Final stage for app image FROM base +# Install packages needed for deployment +RUN apt-get update -qq && \ + apt-get install --no-install-recommends -y imagemagick libvips && \ + rm -rf /var/lib/apt/lists /var/cache/apt/archives # Copy built artifacts: gems, application COPY --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}" diff --git a/test/results/cache/Dockerfile b/test/results/cache/Dockerfile index 0d32a32..7d0dc21 100644 --- a/test/results/cache/Dockerfile +++ b/test/results/cache/Dockerfile @@ -22,7 +22,7 @@ RUN gem update --system --no-document && \ RUN --mount=type=cache,id=dev-apt-cache,sharing=locked,target=/var/cache/apt \ --mount=type=cache,id=dev-apt-lib,sharing=locked,target=/var/lib/apt \ apt-get update -qq && \ - apt-get install --no-install-recommends -y curl libjemalloc2 sqlite3 + apt-get install --no-install-recommends -y curl libjemalloc2 libvips sqlite3 # Set production environment ENV BUNDLE_DEPLOYMENT="1" \ @@ -38,7 +38,7 @@ FROM base AS build RUN --mount=type=cache,id=dev-apt-cache,sharing=locked,target=/var/cache/apt \ --mount=type=cache,id=dev-apt-lib,sharing=locked,target=/var/lib/apt \ apt-get update -qq && \ - apt-get install --no-install-recommends -y build-essential libyaml-dev node-gyp pkg-config python-is-python3 + apt-get install --no-install-recommends -y build-essential libffi-dev libyaml-dev node-gyp pkg-config python-is-python3 # Install JavaScript dependencies ARG NODE_VERSION=xxx @@ -79,6 +79,11 @@ RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile # Final stage for app image FROM base +# Install packages needed for deployment +RUN --mount=type=cache,id=dev-apt-cache,sharing=locked,target=/var/cache/apt \ + --mount=type=cache,id=dev-apt-lib,sharing=locked,target=/var/lib/apt \ + apt-get update -qq && \ + apt-get install --no-install-recommends -y imagemagick libvips # Copy built artifacts: gems, application COPY --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}" diff --git a/test/results/esbuild/Dockerfile b/test/results/esbuild/Dockerfile index e88f42d..34f40f3 100644 --- a/test/results/esbuild/Dockerfile +++ b/test/results/esbuild/Dockerfile @@ -20,7 +20,7 @@ RUN gem update --system --no-document && \ # Install base packages RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y curl libjemalloc2 sqlite3 && \ + apt-get install --no-install-recommends -y curl libjemalloc2 libvips sqlite3 && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Set production environment @@ -35,7 +35,7 @@ FROM base AS build # Install packages needed to build gems and node modules RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y build-essential libyaml-dev node-gyp pkg-config python-is-python3 && \ + apt-get install --no-install-recommends -y build-essential libffi-dev libyaml-dev node-gyp pkg-config python-is-python3 && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Install JavaScript dependencies @@ -70,6 +70,10 @@ RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile # Final stage for app image FROM base +# Install packages needed for deployment +RUN apt-get update -qq && \ + apt-get install --no-install-recommends -y imagemagick libvips && \ + rm -rf /var/lib/apt/lists /var/cache/apt/archives # Copy built artifacts: gems, application COPY --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}" diff --git a/test/results/execjs_importmap/Dockerfile b/test/results/execjs_importmap/Dockerfile index 826c32c..503fb91 100644 --- a/test/results/execjs_importmap/Dockerfile +++ b/test/results/execjs_importmap/Dockerfile @@ -20,7 +20,7 @@ RUN gem update --system --no-document && \ # Install base packages needed to install nodejs RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y curl libjemalloc2 sqlite3 && \ + apt-get install --no-install-recommends -y curl libjemalloc2 libvips sqlite3 && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Set production environment @@ -42,7 +42,7 @@ FROM base AS build # Install packages needed to build gems RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y build-essential libyaml-dev pkg-config && \ + apt-get install --no-install-recommends -y build-essential libffi-dev libyaml-dev pkg-config && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Build options @@ -67,6 +67,10 @@ RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile # Final stage for app image FROM base +# Install packages needed for deployment +RUN apt-get update -qq && \ + apt-get install --no-install-recommends -y imagemagick libvips && \ + rm -rf /var/lib/apt/lists /var/cache/apt/archives # Copy built artifacts: gems, application COPY --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}" diff --git a/test/results/execjs_node/Dockerfile b/test/results/execjs_node/Dockerfile index a5378ab..a415350 100644 --- a/test/results/execjs_node/Dockerfile +++ b/test/results/execjs_node/Dockerfile @@ -20,7 +20,7 @@ RUN gem update --system --no-document && \ # Install base packages needed to install nodejs RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y curl libjemalloc2 sqlite3 && \ + apt-get install --no-install-recommends -y curl libjemalloc2 libvips sqlite3 && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Set production environment @@ -42,7 +42,7 @@ FROM base AS build # Install packages needed to build gems and node modules RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y build-essential libyaml-dev node-gyp pkg-config python-is-python3 && \ + apt-get install --no-install-recommends -y build-essential libffi-dev libyaml-dev node-gyp pkg-config python-is-python3 && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Install yarn @@ -75,6 +75,10 @@ RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile # Final stage for app image FROM base +# Install packages needed for deployment +RUN apt-get update -qq && \ + apt-get install --no-install-recommends -y imagemagick libvips && \ + rm -rf /var/lib/apt/lists /var/cache/apt/archives # Copy built artifacts: gems, application COPY --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}" diff --git a/test/results/litefs/Dockerfile b/test/results/litefs/Dockerfile index e2b3af6..a24d82f 100644 --- a/test/results/litefs/Dockerfile +++ b/test/results/litefs/Dockerfile @@ -20,7 +20,7 @@ RUN gem update --system --no-document && \ # Install base packages RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y curl libjemalloc2 sqlite3 && \ + apt-get install --no-install-recommends -y curl libjemalloc2 libvips sqlite3 && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Set production environment @@ -35,7 +35,7 @@ FROM base AS build # Install packages needed to build gems RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y build-essential libyaml-dev pkg-config && \ + apt-get install --no-install-recommends -y build-essential libffi-dev libyaml-dev pkg-config && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Install application gems @@ -63,7 +63,7 @@ COPY config/litefs.yml /etc/litefs.yml # Install packages needed for deployment RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y ca-certificates fuse3 sudo && \ + apt-get install --no-install-recommends -y ca-certificates fuse3 imagemagick libvips sudo && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Copy built artifacts: gems, application diff --git a/test/results/litestream/Dockerfile b/test/results/litestream/Dockerfile index d12c434..8332bb2 100644 --- a/test/results/litestream/Dockerfile +++ b/test/results/litestream/Dockerfile @@ -20,7 +20,7 @@ RUN gem update --system --no-document && \ # Install base packages RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y curl libjemalloc2 sqlite3 && \ + apt-get install --no-install-recommends -y curl libjemalloc2 libvips sqlite3 && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Set production environment @@ -35,7 +35,7 @@ FROM base AS build # Install packages needed to build gems RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y build-essential libyaml-dev pkg-config && \ + apt-get install --no-install-recommends -y build-essential libffi-dev libyaml-dev pkg-config && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Install application gems @@ -57,6 +57,10 @@ RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile # Final stage for app image FROM base +# Install packages needed for deployment +RUN apt-get update -qq && \ + apt-get install --no-install-recommends -y imagemagick libvips && \ + rm -rf /var/lib/apt/lists /var/cache/apt/archives # Copy built artifacts: gems, application COPY --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}" diff --git a/test/results/mysql/Dockerfile b/test/results/mysql/Dockerfile index 711312e..77baf56 100644 --- a/test/results/mysql/Dockerfile +++ b/test/results/mysql/Dockerfile @@ -20,7 +20,7 @@ RUN gem update --system --no-document && \ # Install base packages RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y curl default-mysql-client libjemalloc2 && \ + apt-get install --no-install-recommends -y curl default-mysql-client libjemalloc2 libvips && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Set production environment @@ -35,7 +35,7 @@ FROM base AS build # Install packages needed to build gems RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y build-essential default-libmysqlclient-dev libyaml-dev && \ + apt-get install --no-install-recommends -y build-essential default-libmysqlclient-dev libffi-dev libyaml-dev && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Install application gems @@ -57,6 +57,10 @@ RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile # Final stage for app image FROM base +# Install packages needed for deployment +RUN apt-get update -qq && \ + apt-get install --no-install-recommends -y imagemagick libvips && \ + rm -rf /var/lib/apt/lists /var/cache/apt/archives # Copy built artifacts: gems, application COPY --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}" diff --git a/test/results/parallel/Dockerfile b/test/results/parallel/Dockerfile index 4d433ca..7cb0381 100644 --- a/test/results/parallel/Dockerfile +++ b/test/results/parallel/Dockerfile @@ -20,7 +20,7 @@ RUN gem update --system --no-document && \ # Install base packages RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y curl libjemalloc2 sqlite3 && \ + apt-get install --no-install-recommends -y curl libjemalloc2 libvips sqlite3 && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Set production environment @@ -35,7 +35,7 @@ FROM base AS prebuild # Install packages needed to build gems and node modules RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y build-essential libyaml-dev node-gyp pkg-config python-is-python3 && \ + apt-get install --no-install-recommends -y build-essential libffi-dev libyaml-dev node-gyp pkg-config python-is-python3 && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives @@ -81,6 +81,10 @@ RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile # Final stage for app image FROM base +# Install packages needed for deployment +RUN apt-get update -qq && \ + apt-get install --no-install-recommends -y imagemagick libvips && \ + rm -rf /var/lib/apt/lists /var/cache/apt/archives # Copy built artifacts: gems, application COPY --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}" diff --git a/test/results/postgresql/Dockerfile b/test/results/postgresql/Dockerfile index a7e87b9..0bfe600 100644 --- a/test/results/postgresql/Dockerfile +++ b/test/results/postgresql/Dockerfile @@ -20,7 +20,7 @@ RUN gem update --system --no-document && \ # Install base packages RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y curl libjemalloc2 postgresql-client && \ + apt-get install --no-install-recommends -y curl libjemalloc2 libvips postgresql-client && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Set production environment @@ -35,7 +35,7 @@ FROM base AS build # Install packages needed to build gems RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y build-essential libpq-dev libyaml-dev && \ + apt-get install --no-install-recommends -y build-essential libffi-dev libpq-dev libyaml-dev && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Install application gems @@ -57,6 +57,10 @@ RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile # Final stage for app image FROM base +# Install packages needed for deployment +RUN apt-get update -qq && \ + apt-get install --no-install-recommends -y imagemagick libvips && \ + rm -rf /var/lib/apt/lists /var/cache/apt/archives # Copy built artifacts: gems, application COPY --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}" diff --git a/test/results/postgresql/database.yml b/test/results/postgresql/database.yml index ea6f00c..73b561b 100644 --- a/test/results/postgresql/database.yml +++ b/test/results/postgresql/database.yml @@ -17,7 +17,7 @@ default: &default encoding: unicode # For details on connection pooling, see Rails configuration guide # https://guides.rubyonrails.org/configuring.html#database-pooling - pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> + max_connections: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> development: diff --git a/test/results/precompile_defer/Dockerfile b/test/results/precompile_defer/Dockerfile index 6f30587..f4350e7 100644 --- a/test/results/precompile_defer/Dockerfile +++ b/test/results/precompile_defer/Dockerfile @@ -20,7 +20,7 @@ RUN gem update --system --no-document && \ # Install base packages RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y curl libjemalloc2 sqlite3 && \ + apt-get install --no-install-recommends -y curl libjemalloc2 libvips sqlite3 && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Set production environment @@ -31,7 +31,7 @@ ENV BUNDLE_DEPLOYMENT="1" \ # Install packages needed to build gems RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y build-essential libyaml-dev pkg-config && \ + apt-get install --no-install-recommends -y build-essential libffi-dev libyaml-dev pkg-config && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Install application gems @@ -45,6 +45,10 @@ COPY . . # Precompile bootsnap code for faster boot times RUN bundle exec bootsnap precompile app/ lib/ +# Install packages needed for deployment +RUN apt-get update -qq && \ + apt-get install --no-install-recommends -y imagemagick libvips && \ + rm -rf /var/lib/apt/lists /var/cache/apt/archives # Run and own only the runtime files as a non-root user for security RUN groupadd --system --gid 1000 rails && \ diff --git a/test/results/redis/Dockerfile b/test/results/redis/Dockerfile index fe22973..c894007 100644 --- a/test/results/redis/Dockerfile +++ b/test/results/redis/Dockerfile @@ -20,7 +20,7 @@ RUN gem update --system --no-document && \ # Install base packages RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y curl libjemalloc2 sqlite3 && \ + apt-get install --no-install-recommends -y curl libjemalloc2 libvips sqlite3 && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Set production environment @@ -35,7 +35,7 @@ FROM base AS build # Install packages needed to build gems RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y build-essential libyaml-dev pkg-config && \ + apt-get install --no-install-recommends -y build-essential libffi-dev libyaml-dev pkg-config && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Install application gems @@ -57,6 +57,10 @@ RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile # Final stage for app image FROM base +# Install packages needed for deployment +RUN apt-get update -qq && \ + apt-get install --no-install-recommends -y imagemagick libvips && \ + rm -rf /var/lib/apt/lists /var/cache/apt/archives # Copy built artifacts: gems, application COPY --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}" diff --git a/test/results/sidekiq/Dockerfile b/test/results/sidekiq/Dockerfile index a7e87b9..0bfe600 100644 --- a/test/results/sidekiq/Dockerfile +++ b/test/results/sidekiq/Dockerfile @@ -20,7 +20,7 @@ RUN gem update --system --no-document && \ # Install base packages RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y curl libjemalloc2 postgresql-client && \ + apt-get install --no-install-recommends -y curl libjemalloc2 libvips postgresql-client && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Set production environment @@ -35,7 +35,7 @@ FROM base AS build # Install packages needed to build gems RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y build-essential libpq-dev libyaml-dev && \ + apt-get install --no-install-recommends -y build-essential libffi-dev libpq-dev libyaml-dev && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Install application gems @@ -57,6 +57,10 @@ RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile # Final stage for app image FROM base +# Install packages needed for deployment +RUN apt-get update -qq && \ + apt-get install --no-install-recommends -y imagemagick libvips && \ + rm -rf /var/lib/apt/lists /var/cache/apt/archives # Copy built artifacts: gems, application COPY --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}" diff --git a/test/results/solid_queue_postgres/Dockerfile b/test/results/solid_queue_postgres/Dockerfile index a7e87b9..0bfe600 100644 --- a/test/results/solid_queue_postgres/Dockerfile +++ b/test/results/solid_queue_postgres/Dockerfile @@ -20,7 +20,7 @@ RUN gem update --system --no-document && \ # Install base packages RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y curl libjemalloc2 postgresql-client && \ + apt-get install --no-install-recommends -y curl libjemalloc2 libvips postgresql-client && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Set production environment @@ -35,7 +35,7 @@ FROM base AS build # Install packages needed to build gems RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y build-essential libpq-dev libyaml-dev && \ + apt-get install --no-install-recommends -y build-essential libffi-dev libpq-dev libyaml-dev && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Install application gems @@ -57,6 +57,10 @@ RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile # Final stage for app image FROM base +# Install packages needed for deployment +RUN apt-get update -qq && \ + apt-get install --no-install-recommends -y imagemagick libvips && \ + rm -rf /var/lib/apt/lists /var/cache/apt/archives # Copy built artifacts: gems, application COPY --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}" diff --git a/test/results/solid_queue_sqlite3/Dockerfile b/test/results/solid_queue_sqlite3/Dockerfile index 575b690..a51f18d 100644 --- a/test/results/solid_queue_sqlite3/Dockerfile +++ b/test/results/solid_queue_sqlite3/Dockerfile @@ -20,7 +20,7 @@ RUN gem update --system --no-document && \ # Install base packages RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y curl libjemalloc2 sqlite3 && \ + apt-get install --no-install-recommends -y curl libjemalloc2 libvips sqlite3 && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Set production environment @@ -35,7 +35,7 @@ FROM base AS build # Install packages needed to build gems RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y build-essential libyaml-dev pkg-config && \ + apt-get install --no-install-recommends -y build-essential libffi-dev libyaml-dev pkg-config && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Install application gems @@ -57,6 +57,10 @@ RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile # Final stage for app image FROM base +# Install packages needed for deployment +RUN apt-get update -qq && \ + apt-get install --no-install-recommends -y imagemagick libvips && \ + rm -rf /var/lib/apt/lists /var/cache/apt/archives # Copy built artifacts: gems, application COPY --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}" diff --git a/test/results/solid_queue_sqlite3/puma.rb b/test/results/solid_queue_sqlite3/puma.rb index 38c4b86..e9b7c6f 100644 --- a/test/results/solid_queue_sqlite3/puma.rb +++ b/test/results/solid_queue_sqlite3/puma.rb @@ -25,8 +25,7 @@ # Any libraries that use a connection pool or another resource pool should # be configured to provide at least as many connections as the number of # threads. This includes Active Record's `pool` parameter in `database.yml`. -threads_count = ENV.fetch("RAILS_MAX_THREADS", 3) -threads threads_count, threads_count +threads ENV.fetch("RAILS_MAX_THREADS", 3) # Specifies the `port` that Puma will listen on to receive requests; default is 3000. port ENV.fetch("PORT", 3000) diff --git a/test/results/sqlite3/Dockerfile b/test/results/sqlite3/Dockerfile index fe22973..c894007 100644 --- a/test/results/sqlite3/Dockerfile +++ b/test/results/sqlite3/Dockerfile @@ -20,7 +20,7 @@ RUN gem update --system --no-document && \ # Install base packages RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y curl libjemalloc2 sqlite3 && \ + apt-get install --no-install-recommends -y curl libjemalloc2 libvips sqlite3 && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Set production environment @@ -35,7 +35,7 @@ FROM base AS build # Install packages needed to build gems RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y build-essential libyaml-dev pkg-config && \ + apt-get install --no-install-recommends -y build-essential libffi-dev libyaml-dev pkg-config && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Install application gems @@ -57,6 +57,10 @@ RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile # Final stage for app image FROM base +# Install packages needed for deployment +RUN apt-get update -qq && \ + apt-get install --no-install-recommends -y imagemagick libvips && \ + rm -rf /var/lib/apt/lists /var/cache/apt/archives # Copy built artifacts: gems, application COPY --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}" diff --git a/test/results/thruster/Dockerfile b/test/results/thruster/Dockerfile index 7f15659..aeaab05 100644 --- a/test/results/thruster/Dockerfile +++ b/test/results/thruster/Dockerfile @@ -20,7 +20,7 @@ RUN gem update --system --no-document && \ # Install base packages RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y curl libjemalloc2 sqlite3 && \ + apt-get install --no-install-recommends -y curl libjemalloc2 libvips sqlite3 && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Set production environment @@ -35,7 +35,7 @@ FROM base AS build # Install packages needed to build gems RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y build-essential libyaml-dev pkg-config && \ + apt-get install --no-install-recommends -y build-essential libffi-dev libyaml-dev pkg-config && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Install application gems @@ -57,6 +57,10 @@ RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile # Final stage for app image FROM base +# Install packages needed for deployment +RUN apt-get update -qq && \ + apt-get install --no-install-recommends -y imagemagick libvips && \ + rm -rf /var/lib/apt/lists /var/cache/apt/archives # Copy built artifacts: gems, application COPY --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}" diff --git a/test/results/trilogy/Dockerfile b/test/results/trilogy/Dockerfile index d964f70..886f5a0 100644 --- a/test/results/trilogy/Dockerfile +++ b/test/results/trilogy/Dockerfile @@ -20,7 +20,7 @@ RUN gem update --system --no-document && \ # Install base packages RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y curl default-mysql-client libjemalloc2 && \ + apt-get install --no-install-recommends -y curl default-mysql-client libjemalloc2 libvips && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Set production environment @@ -35,7 +35,7 @@ FROM base AS build # Install packages needed to build gems RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y build-essential libyaml-dev && \ + apt-get install --no-install-recommends -y build-essential libffi-dev libyaml-dev && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Install application gems @@ -57,6 +57,10 @@ RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile # Final stage for app image FROM base +# Install packages needed for deployment +RUN apt-get update -qq && \ + apt-get install --no-install-recommends -y imagemagick libvips && \ + rm -rf /var/lib/apt/lists /var/cache/apt/archives # Copy built artifacts: gems, application COPY --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}"