From 5c1da5bfa542264e1985b143d5bea87148908eb4 Mon Sep 17 00:00:00 2001 From: redxef Date: Sun, 1 Nov 2020 13:14:04 +0100 Subject: [PATCH] Better build script. --- build.sh | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/build.sh b/build.sh index c14ac3e..8f9c610 100755 --- a/build.sh +++ b/build.sh @@ -1,8 +1,8 @@ #!/usr/bin/env sh platforms() { - local plat="$(grep '^[^#].*' < arch.txt)" - local arch_count="$(echo "$plat" | wc -l)" + plat="$(grep '^[^#].*' < arch.txt)" + arch_count="$(echo "$plat" | wc -l)" echo "$plat" | tr '\n' ',' | cut -d, -f1-$arch_count } @@ -11,9 +11,20 @@ create() { } build() { - local tagname="$1" + tagname="$1" docker pull 'alpine:latest' docker buildx build --push --tag="$tagname" --platform="$(platforms)" . } +get_tag() { + git rev-parse --short HEAD +} + +deploy() { + tag0="redxef/certbot-duckdns:$(get_tag)" + tag1="redxef/certbot-duckdns:latest" + build "$tag0" + build "$tag1" +} + "$@"