【问题标题】:Caching downloads for Vagrant缓存 Vagrant 的下载
【发布时间】:2022-05-16 19:38:14
【问题描述】:

我正在寻找缓存 Vagrant 环境的安装文件的方法,假设这些框是从 vagrant box add 正确填充的。我们的想法是能够在初始下载步骤后稍后在离线环境中测试/开发盒子配置,或者节省下载相同节点副本的相同工件的时间(例如,如果我想运行 10 个相同的从属)。

我最初的想法是将必要的文件下载到 Vagrant 项目到共享文件夹并在配置期间使用这些文件(因此我不需要为每个框重复 curl/wget)。

【问题讨论】:

    标签: vagrant vagrant-provision


    【解决方案1】:

    我写道:

    $share = "share"
    
    Dir.mkdir($share) unless Dir.exist?($share)
    
    # https://pkg.jenkins.io/debian/
    $jenkins_deb_url = "https://pkg.jenkins.io/debian/binary/jenkins_2.86_all.deb"
    $jenkins_deb_file = $share+"/jenkins.deb"
    
    if ! File.exist?($jenkins_deb_file)
      require 'open-uri'
      download = open($jenkins_deb_url)
      IO.copy_stream(download, $jenkins_deb_file)
    end
    

    它并不完美。我无法可靠地自动下载 apt-get install 依赖项(这是满足 Jenkins 依赖项所必需的)以使其完全脱机。

    【讨论】:

      猜你喜欢
      • 2012-07-17
      • 1970-01-01
      • 1970-01-01
      • 2019-10-31
      • 1970-01-01
      • 2010-10-06
      • 2014-09-17
      • 1970-01-01
      • 2014-07-15
      相关资源
      最近更新 更多