private IEnumerable CreatePrepareContextCommand()

in tool/TeamCity.Docker/TeamCityKotlinSettingsGenerator.cs [979:1001]


        private IEnumerable<string> CreatePrepareContextCommand(Image image)
        {
            var tag = image.File.Tags.First();
            yield return "script {";
            yield return $"\t{GetDockerStepStatusDsl(tag)}";

            yield return $"\t name = \"context {image.File.ImageId}:{tag}\"";
            yield return "\t scriptContent = \"\"\"";

            // ReSharper disable once IdentifierTypo
            // ReSharper disable once StringLiteralTypo
            var dockerignore = Path.Combine(_options.ContextPath, ".dockerignore").Replace("\\", "/");
            yield return $"echo 2> {dockerignore}";
            foreach (var ignore in image.File.Ignores)
            {
                yield return $"echo {ignore} >> {dockerignore}";
            }

            yield return "\"\"\".trimIndent()";
            yield return "}";

            yield return string.Empty;
        }