Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration></configuration>
<configuration>
<packageSources>
<clear />
<add key="dotnet-public" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json" />
</packageSources>
</configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ COPY NuGet.config .
? DockerOS.Linux
: DockerOS.Windows;

private static bool s_useNuGetConfig = Config.IsNightlyRepo || Config.IsInternal;

private static string[] s_commonArgs = [
"sdk_image",
"runtime_image",
Expand Down Expand Up @@ -132,30 +130,21 @@ COPY tests/ .

public static TestDockerfile GetBlazorWasmDockerfile(bool useWasmTools)
{
string nugetConfigFileOption = s_useNuGetConfig
? "--configfile NuGet.config"
: string.Empty;

StringBuilder buildStageBuilder = new(
$"""
FROM $sdk_image AS {TestDockerfile.BuildStageName}
ARG InternalAccessToken
ARG port
EXPOSE $port
{CopyNuGetConfigCommands}
""");

if (s_useNuGetConfig)
{
buildStageBuilder.AppendLine();
buildStageBuilder.AppendLine(CopyNuGetConfigCommands);
}

if (useWasmTools)
{
buildStageBuilder.AppendLine();
buildStageBuilder.AppendLine(
$"""
RUN dotnet workload install {nugetConfigFileOption} wasm-tools \
RUN dotnet workload install --configfile NuGet.config wasm-tools \
&& . /etc/os-release \
&& case $ID in \
alpine) apk add --no-cache python3 ;; \
Expand Down Expand Up @@ -210,17 +199,7 @@ ARG rid
ARG InternalAccessToken
ARG port
EXPOSE $port
""");

if (s_useNuGetConfig)
{
buildStageBuilder.AppendLine();
buildStageBuilder.AppendLine(CopyNuGetConfigCommands);
}

buildStageBuilder.AppendLine();
buildStageBuilder.AppendLine(
$"""
{CopyNuGetConfigCommands}
WORKDIR /source/app
COPY app/*.csproj .
RUN dotnet restore -r {FormatArg("rid")}
Expand Down
11 changes: 4 additions & 7 deletions tests/Microsoft.DotNet.Docker.Tests/TestSolution.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ private string CreateTestSolutionWithSdkImage(string solutionDir, string appType
CreateProjectWithSdkImage("xunit", _testProjectDir, testProjectContainerName);
File.Copy(Path.Combine(DockerHelper.TestArtifactsDir, "UnitTests.cs"), Path.Combine(_testProjectDir, "UnitTests.cs"));

string nuGetConfigFileName = string.Empty;
string nuGetConfigFileName = "NuGet.config";
if (Config.IsInternal)
{
nuGetConfigFileName = "NuGet.config.internal";
Expand All @@ -66,12 +66,9 @@ private string CreateTestSolutionWithSdkImage(string solutionDir, string appType
nuGetConfigFileName = "NuGet.config.nightly";
}

if (!string.IsNullOrEmpty(nuGetConfigFileName))
{
File.Copy(
Path.Combine(DockerHelper.TestArtifactsDir, nuGetConfigFileName),
Path.Combine(solutionDir, "NuGet.config"));
}
File.Copy(
Path.Combine(DockerHelper.TestArtifactsDir, nuGetConfigFileName),
Path.Combine(solutionDir, "NuGet.config"));

File.Copy(Path.Combine(DockerHelper.TestArtifactsDir, ".dockerignore"), Path.Combine(solutionDir, ".dockerignore"));
}
Expand Down