Sha256: 504a42ab3d1148b5ffc1386d343bfffafd1390645490d4638a0a44b0356521e3

Contents?: true

Size: 1020 Bytes

Versions: 5

Compression:

Stored size: 1020 Bytes

Contents

# typed: strict

module Kuby
  module Docker
    module Packages
      class Nodejs < Package
        # extend T::Sig

        # T::Sig::WithoutRuntime.sig { params(dockerfile: Dockerfile).void }
        def install_on_debian(dockerfile)
          install_from_image("node:#{version}", dockerfile)
        end

        # T::Sig::WithoutRuntime.sig { params(dockerfile: Dockerfile).void }
        def install_on_alpine(dockerfile)
          install_from_image("node:#{version}-alpine", dockerfile)
        end

        # T::Sig::WithoutRuntime.sig { returns(String) }
        def version
          @version || 'current'
        end

        private

        # T::Sig::WithoutRuntime.sig { params(image: String, dockerfile: Dockerfile).void }
        def install_from_image(image, dockerfile)
          dockerfile.insert_at(0) do
            dockerfile.from(image, as: 'nodejs')
          end

          dockerfile.copy('/usr/local/bin/node', '/usr/local/bin/node', from: 'nodejs')
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

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