Exemplo n.º 1
0
        public static async Task <int> Run(ILauncher launcher, IRecorder recorder)
        {
            var cacheDir = await recorder.GetCacheDir();

            var dockerfile = await recorder.LoadDockerfile();

            string tempImageFile;

            await using (FileUtil.CreateTempFile(recorder.WorkspaceDir, out tempImageFile)) {}

            var props = new RunDockerBuild(
                buildContextDir: recorder.BuildContext,
                cacheDir: cacheDir,
                enableNetwork: recorder.EnableNetwork,
                dockerfile: dockerfile,
                proxyImage: "helium-build/container-build-proxy:debian-buster-20190708",
                outputFile: tempImageFile,
                buildArgs: recorder.BuildArgs
                );

            return(await launcher.BuildContainer(recorder.Platform, props));
        }
 protected override void AddContainerBuildArguments(ProcessStartInfo psi, RunDockerBuild build)
 {
     psi.ArgumentList.Add("container-build");
     psi.ArgumentList.Add(JsonConvert.SerializeObject(build));
 }
Exemplo n.º 3
0
 public override Task <int> BuildContainer(PlatformInfo platform, RunDockerBuild props)
 {
     return(RunWebSocketExecutor(props, CancellationToken.None));
 }
Exemplo n.º 4
0
 protected abstract void AddContainerBuildArguments(ProcessStartInfo psi, RunDockerBuild build);
Exemplo n.º 5
0
        public sealed override async Task <int> BuildContainer(PlatformInfo platform, RunDockerBuild props)
        {
            var psi = CreatePSI();

            AddContainerBuildArguments(psi, props);

            var process = Process.Start(psi) ?? throw new Exception("Could not start docker process.");
            await process.WaitForExitAsync();

            return(process.ExitCode);
        }
Exemplo n.º 6
0
 protected override void AddContainerBuildArguments(ProcessStartInfo psi, RunDockerBuild build) =>
 throw new NotSupportedException();
Exemplo n.º 7
0
 public abstract Task <int> BuildContainer(PlatformInfo platform, RunDockerBuild props);