using System; using System.Collections.Generic; using System.IO; using YamlDotNet.Serialization; namespace DockerGenerator { class Program { static void Main(string[] args) { new Program().Run(); } private void Run() { List defs = new List(); defs.Add(new DockerComposeDefinition("btc", new List { "nginx", "btcpayserver", "bitcoin" })); defs.Add(new DockerComposeDefinition("btc-ltc", new List { "nginx", "btcpayserver", "bitcoin", "litecoin" })); var fragmentLocation = FindLocation("docker-fragments"); var productionLocation = FindLocation("Production"); foreach(var def in defs) { def.FragmentLocation = fragmentLocation; def.BuildOutputDirectory = productionLocation; def.Build(); } var testLocation = FindLocation("Test"); foreach(var def in defs) { def.Fragments.Remove("nginx"); def.Fragments.Add("btcpayserver-test"); def.BuildOutputDirectory = testLocation; def.Build(); } } private string FindLocation(string path) { while(true) { if(Directory.Exists(path)) return path; path = Path.Combine("..", path); } } } }