Better build script.

This commit is contained in:
redxef 2020-11-01 13:14:04 +01:00
parent 4531aa5e0e
commit 5c1da5bfa5

View file

@ -1,8 +1,8 @@
#!/usr/bin/env sh #!/usr/bin/env sh
platforms() { platforms() {
local plat="$(grep '^[^#].*' < arch.txt)" plat="$(grep '^[^#].*' < arch.txt)"
local arch_count="$(echo "$plat" | wc -l)" arch_count="$(echo "$plat" | wc -l)"
echo "$plat" | tr '\n' ',' | cut -d, -f1-$arch_count echo "$plat" | tr '\n' ',' | cut -d, -f1-$arch_count
} }
@ -11,9 +11,20 @@ create() {
} }
build() { build() {
local tagname="$1" tagname="$1"
docker pull 'alpine:latest' docker pull 'alpine:latest'
docker buildx build --push --tag="$tagname" --platform="$(platforms)" . 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"
}
"$@" "$@"