@ -89,9 +89,12 @@ namespace DockerGenerator
output . Add ( "networks" , new YamlMappingNode ( networks ) ) ;
var dockerImages = ( ( YamlMappingNode ) output [ "services" ] ) . Children . Select ( kv = > kv . Value [ "image" ] . ToString ( ) ) . ToArray ( ) ;
var dockerImages = ( ( YamlMappingNode ) output [ "services" ] ) . Children . Select ( kv = > kv . Value [ "image" ] . ToString ( ) ) . ToList ( ) ;
dockerImages . Add ( "btcpayserver/docker-compose-builder:1.23.2" ) ;
dockerImages . Add ( "btcpayserver/docker-compose-generator:latest" ) ;
StringBuilder pullImageSh = new StringBuilder ( ) ;
pullImageSh . Append ( $"#!/bin/bash\n\n" ) ;
pullImageSh . Append ( $"# This script is automatically generated via the docker-compose generator and can be use to pull all required docker images \n" ) ;
foreach ( var image in dockerImages )
{
pullImageSh . Append ( $"docker pull $BTCPAY_DOCKER_PULL_FLAGS \" { image } \ "\n" ) ;
@ -100,6 +103,15 @@ namespace DockerGenerator
File . WriteAllText ( outputFile , pullImageSh . ToString ( ) ) ;
Console . WriteLine ( $"Generated {outputFile}" ) ;
StringBuilder saveImages = new StringBuilder ( ) ;
saveImages . Append ( $"#!/bin/bash\n\n" ) ;
saveImages . Append ( $"# This script is automatically generated via the docker-compose generator and can be use to save the docker images in an archive \n" ) ;
saveImages . Append ( $"# ./save-images.sh output.tar \n" ) ;
saveImages . Append ( $"docker save -o \" $ 1 \ " \\\n {string.Join(" \ \ \ n ", dockerImages.Select(o => $" \ "{o}\"" ) ) } ");
outputFile = GetFilePath ( "save-images.sh" ) ;
File . WriteAllText ( outputFile , saveImages . ToString ( ) ) ;
Console . WriteLine ( $"Generated {outputFile}" ) ;
var result = serializer . Serialize ( output ) ;
outputFile = GetFilePath ( ) ;
File . WriteAllText ( outputFile , result . Replace ( "''" , "" ) ) ;