Use generated docker-compose

This commit is contained in:
nicolas.dorier
2018-03-19 22:54:52 +09:00
parent fb543295d9
commit a3e2d5ea9c
13 changed files with 567 additions and 210 deletions

View File

@@ -0,0 +1,45 @@
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<DockerComposeDefinition> defs = new List<DockerComposeDefinition>();
var btc = new DockerComposeDefinition("btc",
new string[] { "nginx", "btcpayserver", "bitcoin" });
defs.Add(btc);
defs.Add(new DockerComposeDefinition("btc-ltc",
new string[] { "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();
}
File.Copy(btc.GetFilePath(), Path.Combine(new FileInfo(btc.GetFilePath()).Directory.FullName, "docker-compose.yml"), true);
}
private string FindLocation(string path)
{
while(true)
{
if(Directory.Exists(path))
return path;
path = Path.Combine("..", path);
}
}
}
}