Class: Kuby::Docker::SetupPhase
- Defined in:
- lib/kuby/docker/setup_phase.rb
Constant Summary collapse
- DEFAULT_WORKING_DIR =
extend T::Sig
'/usr/src/app'.freeze
Instance Attribute Summary collapse
-
#base_image ⇒ Object
T::Sig::WithoutRuntime.sig { returns(String) }.
-
#docker_spec ⇒ Object
readonly
T::Sig::WithoutRuntime.sig { returns(Docker::Spec) }.
-
#rails_env ⇒ Object
T::Sig::WithoutRuntime.sig { returns(T.nilable(String)) }.
-
#working_dir ⇒ Object
T::Sig::WithoutRuntime.sig { returns(T.nilable(String)) }.
Attributes inherited from Layer
Instance Method Summary collapse
-
#apply_to(dockerfile) ⇒ Object
T::Sig::WithoutRuntime.sig { override.params(dockerfile: Dockerfile).void }.
-
#initialize(environment, docker_spec) ⇒ SetupPhase
constructor
T::Sig::WithoutRuntime.sig { params(environment: Environment, docker_spec: Docker::Spec).void }.
Constructor Details
#initialize(environment, docker_spec) ⇒ SetupPhase
T::Sig::WithoutRuntime.sig { params(environment: Environment, docker_spec: Docker::Spec).void }
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 = docker_spec end |
Instance Attribute Details
#base_image ⇒ Object
T::Sig::WithoutRuntime.sig { returns(String) }
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)
T::Sig::WithoutRuntime.sig { returns(Docker::Spec) }
26 27 28 |
# File 'lib/kuby/docker/setup_phase.rb', line 26 def docker_spec @docker_spec end |
#rails_env ⇒ Object
T::Sig::WithoutRuntime.sig { returns(T.nilable(String)) }
20 21 22 |
# File 'lib/kuby/docker/setup_phase.rb', line 20 def rails_env @rails_env end |
#working_dir ⇒ Object
T::Sig::WithoutRuntime.sig { returns(T.nilable(String)) }
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
T::Sig::WithoutRuntime.sig { override.params(dockerfile: Dockerfile).void }
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 |