コード例 #1
0
        public Task Run()
        {
            var clonePath  = appConfig.ClonePath;
            var dockerFile = Path.GetFullPath(Path.Combine(clonePath, appConfig.Dockerfile ?? throw new InvalidOperationException($"Please provide {nameof(appConfig.Dockerfile)} when using build.")));
            var image      = appConfig.Name;
            var buildTag   = appConfig.GetBuildTag();
            var currentTag = appConfig.GetCurrentTag();

            var args = $"build {clonePath} -f {dockerFile} -t {image}:{buildTag} -t {image}:{currentTag}";

            if (appConfig.AlwaysPull)
            {
                args += " --pull";
            }

            processRunner.RunProcessWithOutput(new ProcessStartInfo("docker", args));

            return(Task.CompletedTask);
        }