private static void DockerTestRun(this BuildContextBase context, string image, Architecture arch, string command, params string[] args) { var settings = GetDockerRunSettings(context, arch); context.Information($"Testing image: {image}"); var output = context.DockerRunImage(settings, image, command, args); context.Information("Output : " + output); Assert.Contains(context.Version?.GitVersion.FullSemVer, output); }
public static void DockerBuildImage(this BuildContextBase context, DockerImage dockerImage) { if (context.Version == null) { return; } var(distro, targetFramework, arch, registry, _) = dockerImage; context.Information($"Building image: {dockerImage}"); var workDir = Paths.Src.Combine("Docker"); var tags = context.GetDockerTags(dockerImage, arch); var suffix = arch.ToSuffix(); var platforms = new List <string> { $"linux/{suffix}" }; var buildSettings = new DockerImageBuildSettings { Rm = true, Tag = tags.ToArray(), File = workDir.CombineWithFilePath("Dockerfile").FullPath, BuildArg = new[] { $"contentFolder=/content", $"REGISTRY={registry}", $"DOTNET_VERSION={targetFramework}", $"DISTRO={distro}", $"VERSION={context.Version.NugetVersion}" }, Pull = true, Platform = string.Join(",", platforms), }; context.DockerBuild(buildSettings, workDir.ToString(), "--output type=docker"); }