【问题标题】:Plastic in Docker windows containersDocker windows 容器中的塑料
【发布时间】:2022-06-23 01:20:24
【问题描述】:

我想在 Docker windows 容器中使用塑料 SCM。 我在 Plastic 中搜索并找到了 Linux 容器 docker 文件 所以我想尝试我自己的 docker 文件,因为我需要知道使用 PowerShell 下载 SCM 安装文件的命令,并通过 Powershell 安装它而不使用 GUI(用于安装的参数)

【问题讨论】:

    标签: windows powershell dockerfile plasticscm


    【解决方案1】:

    这是我目前用于 Windows 图像的脚本。我会警告你,在构建过程中安装确实需要大约 5-10 分钟,但除此之外一切都很好。它的工作原理非常简单,它创建一个临时文件夹并使用下载 URL 在那里下载安装程序,然后运行安装程序,最后删除临时文件夹。

        #This installs plastic
    
        $tempFolder = "C:\Temp"
        $plasticURL = "https://www.plasticscm.com/download/downloadinstaller/10.0.16.5882/plasticscm/windows/client"
        $installerName = "plasticinstalling.exe"
    
        New-Item $tempFolder -ItemType Directory -Force -ErrorAction Stop | Out-Null
    
        $installerLocation = (Join-Path -Path $tempFolder -ChildPath $installerName -ErrorAction Stop)
    
        Invoke-WebRequest -UseBasicParsing -Uri $plasticURL -OutFile $installerLocation -ErrorAction Stop
    
        Start-Process -FilePath $InstallerLocation -ArgumentList "--mode","unattended" -NoNewWindow -Wait -PassThru
    
        Remove-Item -Recurse $tempFolder -Force -ErrorAction Ignore
    

    然后,在我的 docker 文件中,我只调用脚本:

        RUN powershell -Command C:\Scripts\installPlastic.ps1
    

    希望这对您有所帮助,如有更多问题,请随时与我们联系。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-12-15
      • 1970-01-01
      • 2017-09-16
      • 1970-01-01
      • 2018-09-21
      • 1970-01-01
      • 2018-03-16
      • 1970-01-01
      相关资源
      最近更新 更多