Class: Kuby::Docker::SetupPhase
- Extended by:
- T::Sig
- Defined in:
- lib/kuby/docker/setup_phase.rb
Constant Summary collapse
- DEFAULT_WORKING_DIR =
T.let('/usr/src/app'.freeze, String)
Instance Attribute Summary collapse
- #base_image ⇒ Object
-
#docker_spec ⇒ Object
readonly
Returns the value of attribute docker_spec.
-
#rails_env ⇒ Object
Returns the value of attribute rails_env.
-
#working_dir ⇒ Object
Returns the value of attribute working_dir.
Attributes inherited from Layer
Instance Method Summary collapse
- #apply_to(dockerfile) ⇒ Object
-
#initialize(environment, docker_spec) ⇒ SetupPhase
constructor
A new instance of SetupPhase.
Constructor Details
#initialize(environment, docker_spec) ⇒ SetupPhase
Returns a new instance of SetupPhase.
29 30 31 32 33 34 35 36 |
# File 'lib/kuby/docker/setup_phase.rb', line 29 def initialize(environment, docker_spec) super(environment) @base_image = T.let(@base_image, T.nilable(String)) @working_dir = T.let(@working_dir, T.nilable(String)) @rails_env = T.let(@rails_env, T.nilable(String)) @docker_spec = T.let(docker_spec, T.nilable(Docker::Spec)) end |
Instance Attribute Details
#base_image ⇒ Object
48 49 50 |
# File 'lib/kuby/docker/setup_phase.rb', line 48 def base_image @base_image || default_base_image end |
#docker_spec ⇒ Object (readonly)
Returns the value of attribute docker_spec.
26 27 28 |
# File 'lib/kuby/docker/setup_phase.rb', line 26 def docker_spec @docker_spec end |
#rails_env ⇒ Object
Returns the value of attribute rails_env.
20 21 22 |
# File 'lib/kuby/docker/setup_phase.rb', line 20 def rails_env @rails_env end |
#working_dir ⇒ Object
Returns the value of attribute working_dir.
14 15 16 |
# File 'lib/kuby/docker/setup_phase.rb', line 14 def working_dir @working_dir end |
Instance Method Details
#apply_to(dockerfile) ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/kuby/docker/setup_phase.rb', line 39 def apply_to(dockerfile) dockerfile.from(base_image) dockerfile.workdir(working_dir || DEFAULT_WORKING_DIR) dockerfile.env("RAILS_ENV=#{rails_env || Kuby.env}") dockerfile.env("KUBY_ENV=#{Kuby.env}") dockerfile.arg('RAILS_MASTER_KEY') end |