Sha256: 667b1e5b7b55900546677c75807a2d53ba0b97e8b4aa0883fc9e532b285d372d

Contents?: true

Size: 1.68 KB

Versions: 16

Compression:

Stored size: 1.68 KB

Contents

module Kuby
  module Docker
    module Packages
      class Yarn < Package
        def install_on_debian(dockerfile)
          dockerfile.run(<<~CMD.strip)
            wget #{url} && \\
              yarnv=$(basename $(ls yarn-*.tar.gz | cut -d'-' -f 2) .tar.gz) && \\
              tar zxvf yarn-$yarnv.tar.gz -C /opt && \\
              mv /opt/yarn-$yarnv /opt/yarn && \\
              apt-get install -qq -y --no-install-recommends gnupg && \\
              wget -qO- https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --import && \\
              wget https://github.com/yarnpkg/yarn/releases/download/$yarnv/yarn-$yarnv.tar.gz.asc && \\
              gpg --verify yarn-$yarnv.tar.gz.asc
          CMD

          dockerfile.env("PATH=$PATH:/opt/yarn/bin")
        end

        def install_on_alpine(dockerfile)
          dockerfile.run(<<~CMD.strip)
            wget #{url} && \\
              yarnv=$(basename $(ls yarn-*.tar.gz | cut -d'-' -f 2) .tar.gz) && \\
              tar zxvf yarn-$yarnv.tar.gz -C /opt && \\
              mv /opt/yarn-$yarnv /opt/yarn && \\
              apk add --no-cache gnupg && \\
              wget -qO- https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --import && \\
              wget https://github.com/yarnpkg/yarn/releases/download/$yarnv/yarn-$yarnv.tar.gz.asc && \\
              gpg --verify yarn-$yarnv.tar.gz.asc
          CMD

          dockerfile.env("PATH=$PATH:/opt/yarn/bin")
        end

        private

        def url
          @url ||= if version
            "https://github.com/yarnpkg/yarn/releases/download/v#{version}/yarn-v#{version}.tar.gz"
          else
            "https://yarnpkg.com/latest.tar.gz"
          end
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
kuby-core-0.10.1 lib/kuby/docker/packages/yarn.rb
kuby-core-0.10.0 lib/kuby/docker/packages/yarn.rb
kuby-core-0.9.1 lib/kuby/docker/packages/yarn.rb
kuby-core-0.9.0 lib/kuby/docker/packages/yarn.rb
kuby-core-0.8.1 lib/kuby/docker/packages/yarn.rb
kuby-core-0.8.0 lib/kuby/docker/packages/yarn.rb
kuby-core-0.7.2 lib/kuby/docker/packages/yarn.rb
kuby-core-0.7.1 lib/kuby/docker/packages/yarn.rb
kuby-core-0.7.0 lib/kuby/docker/packages/yarn.rb
kuby-core-0.6.1 lib/kuby/docker/packages/yarn.rb
kuby-core-0.6.0 lib/kuby/docker/packages/yarn.rb
kuby-core-0.5.0 lib/kuby/docker/packages/yarn.rb
kuby-core-0.4.0 lib/kuby/docker/packages/yarn.rb
kuby-core-0.3.0 lib/kuby/docker/packages/yarn.rb
kuby-core-0.2.0 lib/kuby/docker/packages/yarn.rb
kuby-core-0.1.0 lib/kuby/docker/packages/yarn.rb