diff --git a/contrib/DockerFileBuildHelper/DockerFile.cs b/contrib/DockerFileBuildHelper/DockerFile.cs index b1d7d82..ff55dbb 100644 --- a/contrib/DockerFileBuildHelper/DockerFile.cs +++ b/contrib/DockerFileBuildHelper/DockerFile.cs @@ -7,7 +7,17 @@ namespace DockerFileBuildHelper public class DockerFile { public string DockerFileName { get; private set; } - public string DockerFilePath { get; private set; } + public string DockerDirectoryPath { get; private set; } + public string DockerFullPath + { + get + { + if (DockerDirectoryPath == ".") + return $"{DockerFileName}"; + else + return $"{DockerDirectoryPath}/{DockerFileName}"; + } + } public static DockerFile Parse(string str) { @@ -16,11 +26,11 @@ namespace DockerFileBuildHelper file.DockerFileName = str.Substring(lastPart + 1); if (lastPart == -1) { - file.DockerFilePath = "."; + file.DockerDirectoryPath = "."; } else { - file.DockerFilePath = str.Substring(0, lastPart); + file.DockerDirectoryPath = str.Substring(0, lastPart); } return file; } diff --git a/contrib/DockerFileBuildHelper/Program.cs b/contrib/DockerFileBuildHelper/Program.cs index bd8cde0..2f1a583 100644 --- a/contrib/DockerFileBuildHelper/Program.cs +++ b/contrib/DockerFileBuildHelper/Program.cs @@ -53,21 +53,58 @@ namespace DockerFileBuildHelper var canDownloadEverything = downloading.All(o => o.Result); if (!canDownloadEverything) return false; - StringBuilder builder = new StringBuilder(); + var builder = new StringBuilderEx(); builder.AppendLine("#!/bin/bash"); builder.AppendLine(); builder.AppendLine("# This file is automatically generated by the DockerFileBuildHelper tool, run DockerFileBuildHelper/update-repo.sh to update it"); builder.AppendLine("set -e"); + builder.AppendLine("DOCKERFILE=\"\""); + builder.AppendLine(); + builder.AppendLine(); foreach (var info in dockerInfos) { builder.AppendLine($"# Build {info.Image.Name}"); + bool mightBeUnavailable = false; + if (info.DockerFilePath != null) + { + var dockerFile = DockerFile.Parse(info.DockerFilePath); + builder.AppendLine($"# {info.GetGithubLinkOf(dockerFile.DockerFullPath)}"); + builder.AppendLine($"DOCKERFILE=\"{dockerFile.DockerFullPath}\""); + } + else + { + builder.AppendLine($"DOCKERFILE=\"\""); + mightBeUnavailable = true; + } + if (info.DockerFilePathARM32v7 != null) + { + var dockerFile = DockerFile.Parse(info.DockerFilePathARM32v7); + builder.AppendLine($"# {info.GetGithubLinkOf(dockerFile.DockerFullPath)}"); + builder.AppendLine($"[[ \"$(uname -m)\" == \"armv7l\" ]] && DOCKERFILE=\"{dockerFile.DockerFullPath}\""); + } + if (info.DockerFilePathARM64v8 != null) + { + var dockerFile = DockerFile.Parse(info.DockerFilePathARM64v8); + builder.AppendLine($"# {info.GetGithubLinkOf(dockerFile.DockerFullPath)}"); + builder.AppendLine($"[[ \"$(uname -m)\" == \"aarch64\" ]] && DOCKERFILE=\"{dockerFile.DockerFullPath}\""); + } + if(mightBeUnavailable) + { + builder.AppendLine($"if [[ \"$DOCKERFILE\" ]]; then"); + builder.Indent++; + } + builder.AppendLine($"echo \"Building {info.Image.ToString()}\""); builder.AppendLine($"git clone {info.GitLink} {info.Image.Name}"); - var dockerFile = DockerFile.Parse($"{info.DockerFilePath ?? info.DockerFilePathARM32v7 ?? info.DockerFilePathARM64v8}"); builder.AppendLine($"cd {info.Image.Name}"); builder.AppendLine($"git checkout {info.GitRef}"); - builder.AppendLine($"cd {dockerFile.DockerFilePath}"); - builder.AppendLine($"docker build -f \"{dockerFile.DockerFileName}\" -t \"{info.Image}\" ."); + builder.AppendLine($"cd \"$(dirname $DOCKERFILE)\""); + builder.AppendLine($"docker build -f \"$DOCKERFILE\" -t \"{info.Image}\" ."); builder.AppendLine($"cd - && cd .."); + if (mightBeUnavailable) + { + builder.Indent--; + builder.AppendLine($"fi"); + } builder.AppendLine(); builder.AppendLine(); } diff --git a/contrib/DockerFileBuildHelper/StringBuilderEx.cs b/contrib/DockerFileBuildHelper/StringBuilderEx.cs new file mode 100644 index 0000000..6823e58 --- /dev/null +++ b/contrib/DockerFileBuildHelper/StringBuilderEx.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace DockerFileBuildHelper +{ + public class StringBuilderEx + { + StringBuilder _Builder = new StringBuilder(); + public StringBuilderEx() + { + + } + + public int Indent { get; set; } + + public void Append(string str) + { + _Builder.Append(GetIndents()); + _Builder.Append(str); + } + + private string GetIndents() + { + return new String(Enumerable.Range(0, Indent).Select(_ => '\t').ToArray()); + } + + public void AppendLine(string str) + { + _Builder.Append(GetIndents()); + _Builder.AppendLine(str); + } + + public override string ToString() + { + return _Builder.ToString(); + } + + internal void AppendLine() + { + _Builder.AppendLine(); + } + } +} diff --git a/contrib/build-all-images.sh b/contrib/build-all-images.sh index 0877848..f740aea 100755 --- a/contrib/build-all-images.sh +++ b/contrib/build-all-images.sh @@ -2,201 +2,291 @@ # This file is automatically generated by the DockerFileBuildHelper tool, run DockerFileBuildHelper/update-repo.sh to update it set -e +DOCKERFILE="" + + # Build docker-compose-generator +# https://raw.githubusercontent.com/btcpayserver/btcpayserver-docker/dcg-latest/docker-compose-generator/linuxamd64.Dockerfile +DOCKERFILE="docker-compose-generator/linuxamd64.Dockerfile" +# https://raw.githubusercontent.com/btcpayserver/btcpayserver-docker/dcg-latest/docker-compose-generator/linuxarm32v7.Dockerfile +[[ "$(uname -m)" == "armv7l" ]] && DOCKERFILE="docker-compose-generator/linuxarm32v7.Dockerfile" +echo "Building btcpayserver/docker-compose-generator:latest" git clone https://github.com/btcpayserver/btcpayserver-docker docker-compose-generator cd docker-compose-generator git checkout dcg-latest -cd docker-compose-generator -docker build -f "linuxamd64.Dockerfile" -t "btcpayserver/docker-compose-generator:latest" . +cd "$(dirname $DOCKERFILE)" +docker build -f "$DOCKERFILE" -t "btcpayserver/docker-compose-generator:latest" . cd - && cd .. # Build docker-compose-builder -git clone https://github.com/btcpayserver/docker-compose-builder docker-compose-builder -cd docker-compose-builder -git checkout v1.23.2 -cd . -docker build -f "linuxarm32v7.Dockerfile" -t "btcpayserver/docker-compose-builder:1.23.2" . -cd - && cd .. +DOCKERFILE="" +# https://raw.githubusercontent.com/btcpayserver/docker-compose-builder/v1.23.2/linuxarm32v7.Dockerfile +[[ "$(uname -m)" == "armv7l" ]] && DOCKERFILE="linuxarm32v7.Dockerfile" +if [[ "$DOCKERFILE" ]]; then + echo "Building btcpayserver/docker-compose-builder:1.23.2" + git clone https://github.com/btcpayserver/docker-compose-builder docker-compose-builder + cd docker-compose-builder + git checkout v1.23.2 + cd "$(dirname $DOCKERFILE)" + docker build -f "$DOCKERFILE" -t "btcpayserver/docker-compose-builder:1.23.2" . + cd - && cd .. +fi # Build btglnd +# https://raw.githubusercontent.com/vutov/lnd/master/BTCPayServer.Dockerfile +DOCKERFILE="BTCPayServer.Dockerfile" +echo "Building kamigawabul/btglnd:latest" git clone https://github.com/vutov/lnd btglnd cd btglnd git checkout master -cd . -docker build -f "BTCPayServer.Dockerfile" -t "kamigawabul/btglnd:latest" . +cd "$(dirname $DOCKERFILE)" +docker build -f "$DOCKERFILE" -t "kamigawabul/btglnd:latest" . cd - && cd .. # Build docker-bitcoingold +# https://raw.githubusercontent.com/Vutov/docker-bitcoin/master/bitcoingold/0.15.2/Dockerfile +DOCKERFILE="bitcoingold/0.15.2/Dockerfile" +echo "Building kamigawabul/docker-bitcoingold:0.15.2" git clone https://github.com/Vutov/docker-bitcoin docker-bitcoingold cd docker-bitcoingold git checkout master -cd bitcoingold/0.15.2 -docker build -f "Dockerfile" -t "kamigawabul/docker-bitcoingold:0.15.2" . +cd "$(dirname $DOCKERFILE)" +docker build -f "$DOCKERFILE" -t "kamigawabul/docker-bitcoingold:0.15.2" . cd - && cd .. # Build clightning +# https://raw.githubusercontent.com/NicolasDorier/lightning/basedon-v0.6.2-3/Dockerfile +DOCKERFILE="Dockerfile" +echo "Building nicolasdorier/clightning:v0.6.2-3" git clone https://github.com/NicolasDorier/lightning clightning cd clightning git checkout basedon-v0.6.2-3 -cd . -docker build -f "Dockerfile" -t "nicolasdorier/clightning:v0.6.2-3" . +cd "$(dirname $DOCKERFILE)" +docker build -f "$DOCKERFILE" -t "nicolasdorier/clightning:v0.6.2-3" . cd - && cd .. # Build lnd +# https://raw.githubusercontent.com/btcpayserver/lnd/basedon-v0.5-beta-2/BTCPayServer.Dockerfile +DOCKERFILE="BTCPayServer.Dockerfile" +echo "Building btcpayserver/lnd:0.5-beta-2" git clone https://github.com/btcpayserver/lnd lnd cd lnd git checkout basedon-v0.5-beta-2 -cd . -docker build -f "BTCPayServer.Dockerfile" -t "btcpayserver/lnd:0.5-beta-2" . +cd "$(dirname $DOCKERFILE)" +docker build -f "$DOCKERFILE" -t "btcpayserver/lnd:0.5-beta-2" . cd - && cd .. # Build bitcoin +# https://raw.githubusercontent.com/btcpayserver/dockerfile-deps/Bitcoin/0.17.0/Bitcoin/0.17.0/linuxamd64.Dockerfile +DOCKERFILE="Bitcoin/0.17.0/linuxamd64.Dockerfile" +# https://raw.githubusercontent.com/btcpayserver/dockerfile-deps/Bitcoin/0.17.0/Bitcoin/0.17.0/linuxarm32v7.Dockerfile +[[ "$(uname -m)" == "armv7l" ]] && DOCKERFILE="Bitcoin/0.17.0/linuxarm32v7.Dockerfile" +# https://raw.githubusercontent.com/btcpayserver/dockerfile-deps/Bitcoin/0.17.0/Bitcoin/0.17.0/linuxarm64v8.Dockerfile +[[ "$(uname -m)" == "aarch64" ]] && DOCKERFILE="Bitcoin/0.17.0/linuxarm64v8.Dockerfile" +echo "Building btcpayserver/bitcoin:0.17.0" git clone https://github.com/btcpayserver/dockerfile-deps bitcoin cd bitcoin git checkout Bitcoin/0.17.0 -cd Bitcoin/0.17.0 -docker build -f "linuxamd64.Dockerfile" -t "btcpayserver/bitcoin:0.17.0" . +cd "$(dirname $DOCKERFILE)" +docker build -f "$DOCKERFILE" -t "btcpayserver/bitcoin:0.17.0" . cd - && cd .. # Build btcpayserver +# https://raw.githubusercontent.com/btcpayserver/btcpayserver/v1.0.3.21/Dockerfile.linuxamd64 +DOCKERFILE="Dockerfile.linuxamd64" +# https://raw.githubusercontent.com/btcpayserver/btcpayserver/v1.0.3.21/Dockerfile.linuxarm32v7 +[[ "$(uname -m)" == "armv7l" ]] && DOCKERFILE="Dockerfile.linuxarm32v7" +echo "Building btcpayserver/btcpayserver:1.0.3.21" git clone https://github.com/btcpayserver/btcpayserver btcpayserver cd btcpayserver git checkout v1.0.3.21 -cd . -docker build -f "Dockerfile.linuxamd64" -t "btcpayserver/btcpayserver:1.0.3.21" . +cd "$(dirname $DOCKERFILE)" +docker build -f "$DOCKERFILE" -t "btcpayserver/btcpayserver:1.0.3.21" . cd - && cd .. # Build dogecoin +# https://raw.githubusercontent.com/rockstardev/docker-bitcoin/feature/dogecoin/dogecoin/1.10.0/Dockerfile +DOCKERFILE="dogecoin/1.10.0/Dockerfile" +echo "Building rockstardev/dogecoin:1.10.0" git clone https://github.com/rockstardev/docker-bitcoin dogecoin cd dogecoin git checkout feature/dogecoin -cd dogecoin/1.10.0 -docker build -f "Dockerfile" -t "rockstardev/dogecoin:1.10.0" . +cd "$(dirname $DOCKERFILE)" +docker build -f "$DOCKERFILE" -t "rockstardev/dogecoin:1.10.0" . cd - && cd .. # Build docker-feathercoin +# https://raw.githubusercontent.com/ChekaZ/docker/master/feathercoin/0.16.3/Dockerfile +DOCKERFILE="feathercoin/0.16.3/Dockerfile" +echo "Building chekaz/docker-feathercoin:0.16.3" git clone https://github.com/ChekaZ/docker docker-feathercoin cd docker-feathercoin git checkout master -cd feathercoin/0.16.3 -docker build -f "Dockerfile" -t "chekaz/docker-feathercoin:0.16.3" . +cd "$(dirname $DOCKERFILE)" +docker build -f "$DOCKERFILE" -t "chekaz/docker-feathercoin:0.16.3" . cd - && cd .. # Build docker-groestlcoin +# https://raw.githubusercontent.com/NicolasDorier/docker-bitcoin/master/groestlcoin/2.16.3/Dockerfile +DOCKERFILE="groestlcoin/2.16.3/Dockerfile" +echo "Building nicolasdorier/docker-groestlcoin:2.16.3" git clone https://github.com/NicolasDorier/docker-bitcoin docker-groestlcoin cd docker-groestlcoin git checkout master -cd groestlcoin/2.16.3 -docker build -f "Dockerfile" -t "nicolasdorier/docker-groestlcoin:2.16.3" . +cd "$(dirname $DOCKERFILE)" +docker build -f "$DOCKERFILE" -t "nicolasdorier/docker-groestlcoin:2.16.3" . cd - && cd .. # Build clightning +# https://raw.githubusercontent.com/NicolasDorier/lightning/basedon-v0.6.2-3/Dockerfile +DOCKERFILE="Dockerfile" +echo "Building nicolasdorier/clightning:v0.6.2-3" git clone https://github.com/NicolasDorier/lightning clightning cd clightning git checkout basedon-v0.6.2-3 -cd . -docker build -f "Dockerfile" -t "nicolasdorier/clightning:v0.6.2-3" . +cd "$(dirname $DOCKERFILE)" +docker build -f "$DOCKERFILE" -t "nicolasdorier/clightning:v0.6.2-3" . cd - && cd .. # Build lnd +# https://raw.githubusercontent.com/btcpayserver/lnd/basedon-v0.5-beta-2/BTCPayServer.Dockerfile +DOCKERFILE="BTCPayServer.Dockerfile" +echo "Building btcpayserver/lnd:0.5-beta-2" git clone https://github.com/btcpayserver/lnd lnd cd lnd git checkout basedon-v0.5-beta-2 -cd . -docker build -f "BTCPayServer.Dockerfile" -t "btcpayserver/lnd:0.5-beta-2" . +cd "$(dirname $DOCKERFILE)" +docker build -f "$DOCKERFILE" -t "btcpayserver/lnd:0.5-beta-2" . cd - && cd .. # Build docker-litecoin +# https://raw.githubusercontent.com/NicolasDorier/docker-bitcoin/master/litecoin/0.16.3/Dockerfile +DOCKERFILE="litecoin/0.16.3/Dockerfile" +echo "Building nicolasdorier/docker-litecoin:0.16.3" git clone https://github.com/NicolasDorier/docker-bitcoin docker-litecoin cd docker-litecoin git checkout master -cd litecoin/0.16.3 -docker build -f "Dockerfile" -t "nicolasdorier/docker-litecoin:0.16.3" . +cd "$(dirname $DOCKERFILE)" +docker build -f "$DOCKERFILE" -t "nicolasdorier/docker-litecoin:0.16.3" . cd - && cd .. # Build docker-monacoin +# https://raw.githubusercontent.com/wakiyamap/docker-bitcoin/master/monacoin/0.16.3/Dockerfile +DOCKERFILE="monacoin/0.16.3/Dockerfile" +echo "Building wakiyamap/docker-monacoin:0.16.3" git clone https://github.com/wakiyamap/docker-bitcoin docker-monacoin cd docker-monacoin git checkout master -cd monacoin/0.16.3 -docker build -f "Dockerfile" -t "wakiyamap/docker-monacoin:0.16.3" . +cd "$(dirname $DOCKERFILE)" +docker build -f "$DOCKERFILE" -t "wakiyamap/docker-monacoin:0.16.3" . cd - && cd .. # Build nbxplorer +# https://raw.githubusercontent.com/dgarage/nbxplorer/v2.0.0.1/Dockerfile.linuxamd64 +DOCKERFILE="Dockerfile.linuxamd64" +# https://raw.githubusercontent.com/dgarage/nbxplorer/v2.0.0.1/Dockerfile.linuxarm32v7 +[[ "$(uname -m)" == "armv7l" ]] && DOCKERFILE="Dockerfile.linuxarm32v7" +echo "Building nicolasdorier/nbxplorer:2.0.0.1" git clone https://github.com/dgarage/nbxplorer nbxplorer cd nbxplorer git checkout v2.0.0.1 -cd . -docker build -f "Dockerfile.linuxamd64" -t "nicolasdorier/nbxplorer:2.0.0.1" . +cd "$(dirname $DOCKERFILE)" +docker build -f "$DOCKERFILE" -t "nicolasdorier/nbxplorer:2.0.0.1" . cd - && cd .. # Build nginx +# https://raw.githubusercontent.com/nginxinc/docker-nginx/master/stable/stretch/Dockerfile +DOCKERFILE="stable/stretch/Dockerfile" +echo "Building nginx:stable" git clone https://github.com/nginxinc/docker-nginx nginx cd nginx git checkout master -cd stable/stretch -docker build -f "Dockerfile" -t "nginx:stable" . +cd "$(dirname $DOCKERFILE)" +docker build -f "$DOCKERFILE" -t "nginx:stable" . cd - && cd .. # Build docker-gen +# https://raw.githubusercontent.com/btcpayserver/docker-gen/v0.7.4/linuxamd64.Dockerfile +DOCKERFILE="linuxamd64.Dockerfile" +# https://raw.githubusercontent.com/btcpayserver/docker-gen/v0.7.4/linuxarm32v7.Dockerfile +[[ "$(uname -m)" == "armv7l" ]] && DOCKERFILE="linuxarm32v7.Dockerfile" +echo "Building btcpayserver/docker-gen:0.7.4" git clone https://github.com/btcpayserver/docker-gen docker-gen cd docker-gen git checkout v0.7.4 -cd . -docker build -f "linuxamd64.Dockerfile" -t "btcpayserver/docker-gen:0.7.4" . +cd "$(dirname $DOCKERFILE)" +docker build -f "$DOCKERFILE" -t "btcpayserver/docker-gen:0.7.4" . cd - && cd .. # Build letsencrypt-nginx-proxy-companion +# https://raw.githubusercontent.com/btcpayserver/docker-letsencrypt-nginx-proxy-companion/v1.10.0/linuxamd64.Dockerfile +DOCKERFILE="linuxamd64.Dockerfile" +# https://raw.githubusercontent.com/btcpayserver/docker-letsencrypt-nginx-proxy-companion/v1.10.0/linuxarm32v7.Dockerfile +[[ "$(uname -m)" == "armv7l" ]] && DOCKERFILE="linuxarm32v7.Dockerfile" +echo "Building btcpayserver/letsencrypt-nginx-proxy-companion:1.10.0" git clone https://github.com/btcpayserver/docker-letsencrypt-nginx-proxy-companion letsencrypt-nginx-proxy-companion cd letsencrypt-nginx-proxy-companion git checkout v1.10.0 -cd . -docker build -f "linuxamd64.Dockerfile" -t "btcpayserver/letsencrypt-nginx-proxy-companion:1.10.0" . +cd "$(dirname $DOCKERFILE)" +docker build -f "$DOCKERFILE" -t "btcpayserver/letsencrypt-nginx-proxy-companion:1.10.0" . cd - && cd .. # Build postgres +# https://raw.githubusercontent.com/docker-library/postgres/b7cb3c6eacea93be2259381033be3cc435649369/9.6/Dockerfile +DOCKERFILE="9.6/Dockerfile" +# https://raw.githubusercontent.com/docker-library/postgres/b7cb3c6eacea93be2259381033be3cc435649369/9.6/Dockerfile +[[ "$(uname -m)" == "armv7l" ]] && DOCKERFILE="9.6/Dockerfile" +echo "Building postgres:9.6.5" git clone https://github.com/docker-library/postgres postgres cd postgres git checkout b7cb3c6eacea93be2259381033be3cc435649369 -cd 9.6 -docker build -f "Dockerfile" -t "postgres:9.6.5" . +cd "$(dirname $DOCKERFILE)" +docker build -f "$DOCKERFILE" -t "postgres:9.6.5" . cd - && cd .. # Build traefik +# https://raw.githubusercontent.com/containous/traefik-library-image/master/scratch/amd64/Dockerfile +DOCKERFILE="scratch/amd64/Dockerfile" +# https://raw.githubusercontent.com/containous/traefik-library-image/master/scratch/arm/Dockerfile +[[ "$(uname -m)" == "armv7l" ]] && DOCKERFILE="scratch/arm/Dockerfile" +echo "Building traefik:latest" git clone https://github.com/containous/traefik-library-image traefik cd traefik git checkout master -cd scratch/amd64 -docker build -f "Dockerfile" -t "traefik:latest" . +cd "$(dirname $DOCKERFILE)" +docker build -f "$DOCKERFILE" -t "traefik:latest" . cd - && cd .. # Build docker-viacoin +# https://raw.githubusercontent.com/viacoin/docker-viacoin/master/viacoin/0.15.2/docker-viacoin +DOCKERFILE="viacoin/0.15.2/docker-viacoin" +echo "Building romanornr/docker-viacoin:0.15.2" git clone https://github.com/viacoin/docker-viacoin docker-viacoin cd docker-viacoin git checkout master -cd viacoin/0.15.2 -docker build -f "docker-viacoin" -t "romanornr/docker-viacoin:0.15.2" . +cd "$(dirname $DOCKERFILE)" +docker build -f "$DOCKERFILE" -t "romanornr/docker-viacoin:0.15.2" . cd - && cd ..