src/Create-DockerfileSolutionRestore.ps1
(完整代码) 1KBparam (
[string]$solution = "eShopOnContainers-ServicesAndWebApps.sln"
)
$outfile = "DockerfileSolutionRestore.txt"
# This script creates the $outfile file, with Dockerfile commands to restore all the packages for the solution,
# so you can insert them (by hand) into Dockerfiles right before the "COPY . ." line
# to increase build speed by optimizing the use of docker build images cache.
# This script is only needed when adding or removing projects from the solution.
Write-Output "COPY ""$solution"" ""$solution""" > $outfile
Add-Content -Path $outfile ""
Select-String -Path $solution -Pattern ', "(.*?\.csproj)"' | ForEach-Object { $_.Matches.Groups[1].Value.Replace("\", "/") } | Sort-Object | ForEach-Object {"COPY ""$_"" ""$_"""} | Out-File -FilePath $outfile -Append
Add-Content -Path $outfile ""
Select-String -Path $solution -Pattern ', "(.*?\.dcproj)"' | ForEach-Object { $_.Matches.Groups[1].Value.Replace("\", "/") } | Sort-Object | ForEach-Object {"COPY ""$_"" ""$_"""} | Out-File -FilePath $outfile -Append
Add-Content -Path $outfile ""
Add-Content -Path $outfile "COPY ""NuGet.config"" ""NuGet.config"""
Add-Content -Path $outfile ""
Add-Content -Path $outfile "RUN dotnet restore ""$solution"""
Get-Content $outfile
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。