Skip to content

Commit

Permalink
Add an advanced option to skip any Gemfile updates
Browse files Browse the repository at this point in the history
  • Loading branch information
albus522 committed May 3, 2024
1 parent 393e227 commit 8e8ac1e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ There may be times where feature detection plus flags just aren't enough. As an

* `--instructions=path` - a dockerfile fragment to be inserted into the final document.
* `--migration=cmd` - a replacement (generally a script) for `db:prepare`/`db:migrate`.
* `--no-gemfile-updates` - do not modify my gemfile.
* `--procfile=path` - a [Procfile](https://github.com/ddollar/foreman#foreman) to use in place of launching Rails directly.

Like with environment variables, packages, and build args, `--instructions` can be tailored to a specific build phase by adding `-base`, `-build`, or `-deploy` after the flag name, with the default being `-deploy`.
Expand Down
6 changes: 6 additions & 0 deletions lib/generators/dockerfile_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class DockerfileGenerator < Rails::Generators::Base
"ci" => false,
"compose" => false,
"fullstaq" => false,
"gemfile-updates" => true,
"jemalloc" => false,
"label" => {},
"link" => true,
Expand Down Expand Up @@ -219,6 +220,9 @@ class DockerfileGenerator < Rails::Generators::Base
class_option "private-gemserver-domain", type: :string, default: OPTION_DEFAULTS["private-gemserver-domain"],
desc: "domain name of a private gemserver used when installing application gems"

class_option "gemfile-updates", type: :boolean, default: OPTION_DEFAULTS["gemfile-updates"],
desc: "include gemfile updates"


class_option "add-base", type: :array, default: [],
desc: "additional packages to install for both build and deploy"
Expand Down Expand Up @@ -510,6 +514,8 @@ def keeps?
end

def install_gems
return unless options["gemfile-updates"]

ENV["BUNDLE_IGNORE_MESSAGES"] = "1"

gemfile = IO.read("Gemfile")
Expand Down

0 comments on commit 8e8ac1e

Please sign in to comment.