Class: Kuby::Docker::AppPhase
- Defined in:
- lib/kuby/docker/app_phase.rb
Instance Attribute Summary
Attributes inherited from Layer
Instance Method Summary collapse
-
#apply_to(dockerfile) ⇒ Object
T::Sig::WithoutRuntime.sig { override.params(dockerfile: Dockerfile).void }.
-
#env(key, value) ⇒ Object
T::Sig::WithoutRuntime.sig { params(key: String, value: String).void }.
-
#initialize(environment) ⇒ AppPhase
constructor
T::Sig::WithoutRuntime.sig { params(environment: Environment).void }.
Constructor Details
#initialize(environment) ⇒ AppPhase
T::Sig::WithoutRuntime.sig { params(environment: Environment).void }
9 10 11 12 13 |
# File 'lib/kuby/docker/app_phase.rb', line 9 def initialize(environment) super @env_vars = {} end |
Instance Method Details
#apply_to(dockerfile) ⇒ Object
T::Sig::WithoutRuntime.sig { override.params(dockerfile: Dockerfile).void }
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/kuby/docker/app_phase.rb', line 16 def apply_to(dockerfile) @env_vars.each_pair do |key, value| dockerfile.env("#{key}='#{value}'") end absolute_app_root = Pathname(dockerfile.current_workdir) .join(environment.docker.app_root_path) .to_s if dockerfile.current_workdir != absolute_app_root dockerfile.workdir(absolute_app_root) end end |
#env(key, value) ⇒ Object
T::Sig::WithoutRuntime.sig { params(key: String, value: String).void }
31 32 33 |
# File 'lib/kuby/docker/app_phase.rb', line 31 def env(key, value) @env_vars[key] = value end |