diff --git a/configs/devkit/linux/agent/Ubuntu.devkit.Dockerfile b/configs/devkit/linux/agent/Ubuntu.devkit.Dockerfile
index 8898c4e8e..edd47981e 100644
--- a/configs/devkit/linux/agent/Ubuntu.devkit.Dockerfile
+++ b/configs/devkit/linux/agent/Ubuntu.devkit.Dockerfile
@@ -10,7 +10,18 @@ FROM ${teamCityImage}
USER root
-RUN rm -rf /opt/buildagent/*
+# Remove agent code sequentially to work around the inability to delete volumes from the base image.
+RUN rm -rf '/opt/buildagent/bin' && \
+ rm -rf '/opt/buildagent/tools' && \
+ rm -rf '/opt/buildagent/system' && \
+ rm -rf '/opt/buildagent/plugins' && \
+ rm -rf '/opt/buildagent/temp' && \
+ rm -rf '/opt/buildagent/work' && \
+ rm -rf '/opt/buildagent/lib' && \
+ rm -rf '/opt/buildagent/conf' && \
+ rm -rf '/opt/buildagent/launcher' && \
+ rm -rf '/data/teamcity_agent/conf'
+
USER buildagent
CMD ["sleep", "infinity"]
\ No newline at end of file
diff --git a/tool/TeamCity.Docker/ConfigurationExplorer.cs b/tool/TeamCity.Docker/ConfigurationExplorer.cs
index 7ba2b3b3c..708566414 100644
--- a/tool/TeamCity.Docker/ConfigurationExplorer.cs
+++ b/tool/TeamCity.Docker/ConfigurationExplorer.cs
@@ -9,6 +9,9 @@ namespace TeamCity.Docker
using IoC;
using Model;
+ ///
+ /// Locates configuration files for Docker Images.
+ ///
internal class ConfigurationExplorer : IConfigurationExplorer
{
[NotNull] private readonly ILogger _logger;
@@ -21,7 +24,7 @@ public ConfigurationExplorer(
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
_fileSystem = fileSystem ?? throw new ArgumentNullException(nameof(fileSystem));
}
-
+
public Result> Explore(string sourcePath, IEnumerable configurationFiles)
{
if (sourcePath == null)
@@ -95,9 +98,10 @@ private IEnumerable GetConfigurations([NotNull] string sourcePath, [No
var ignore = new List();
if (_fileSystem.IsFileExist(dockerignoreTemplatePath))
{
+ // Add .Dockerignore files
ignore.AddRange(_fileSystem.ReadLines(dockerignoreTemplatePath));
}
-
+
yield return new Template(_fileSystem.ReadLines(dockerfileTemplate).ToImmutableList(), variants.AsReadOnly(), ignore.AsReadOnly());
}
}
diff --git a/tool/TeamCity.Docker/DockerGraphFactory.cs b/tool/TeamCity.Docker/DockerGraphFactory.cs
index 231049d4b..986b7c50e 100644
--- a/tool/TeamCity.Docker/DockerGraphFactory.cs
+++ b/tool/TeamCity.Docker/DockerGraphFactory.cs
@@ -49,6 +49,7 @@ public Result> Create(IEnumerable templa
var nodeDict = new Dictionary>();
foreach (var template in templates)
{
+ // "variants" are different Dockerfile.config files for the template
foreach (var variant in template.Variants)
{
var lines = _contentParser.Parse(template.Lines, variant.Variables).ToImmutableList();
diff --git a/tool/TeamCity.Docker/IConfigurationExplorer.cs b/tool/TeamCity.Docker/IConfigurationExplorer.cs
index 8b483b0ec..f566e402b 100644
--- a/tool/TeamCity.Docker/IConfigurationExplorer.cs
+++ b/tool/TeamCity.Docker/IConfigurationExplorer.cs
@@ -4,8 +4,17 @@
using IoC;
using Model;
+ ///
+ /// Describes the contract for locating template files for Docker images.
+ ///
internal interface IConfigurationExplorer
{
+ ///
+ /// Locates configuration files within the given path.
+ ///
+ /// path to directory with the templates of Dockerfiles (configs)
+ /// list of files with configuration properties within source path (.config files)
+ /// list of templates (templates, config values)
Result> Explore([NotNull] string sourcePath, [NotNull] IEnumerable configurationFiles);
}
}
\ No newline at end of file
diff --git a/tool/TeamCity.Docker/Model/Template.cs b/tool/TeamCity.Docker/Model/Template.cs
index 7eb59b82a..53ed4a964 100644
--- a/tool/TeamCity.Docker/Model/Template.cs
+++ b/tool/TeamCity.Docker/Model/Template.cs
@@ -10,6 +10,12 @@ internal readonly struct Template
[NotNull] public readonly IEnumerable Variants;
[NotNull] public readonly IReadOnlyCollection Ignore;
+ ///
+ /// Creates object describing configuration for Dockerfile.
+ ///
+ /// Content of the template Dockerfile.
+ /// Different configuration options (.config files)
+ /// Content of .Dockerignore
public Template([NotNull] IReadOnlyCollection lines, [NotNull] IReadOnlyCollection variants, [NotNull] IReadOnlyCollection ignore)
{
Lines = lines ?? throw new ArgumentNullException(nameof(lines));