Sha256: 9b6e7140f0ad445e4fcef24961c17de1eb758383d7e00192856a86c30e4682be

Contents?: true

Size: 899 Bytes

Versions: 5

Compression:

Stored size: 899 Bytes

Contents

# typed: strict

module Kuby
  module Docker
    class AppPhase < Layer
      # extend T::Sig

      # T::Sig::WithoutRuntime.sig { params(environment: Environment).void }
      def initialize(environment)
        super

        @env_vars = {}
      end

      # T::Sig::WithoutRuntime.sig { override.params(dockerfile: Dockerfile).void }
      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

      # T::Sig::WithoutRuntime.sig { params(key: String, value: String).void }
      def env(key, value)
        @env_vars[key] = value
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
kuby-core-0.20.2 lib/kuby/docker/app_phase.rb
kuby-core-0.20.1 lib/kuby/docker/app_phase.rb
kuby-core-0.20.0 lib/kuby/docker/app_phase.rb
kuby-core-0.19.0 lib/kuby/docker/app_phase.rb
kuby-core-0.18.0 lib/kuby/docker/app_phase.rb