certbot-duckdns/build.sh

31 lines
544 B
Bash
Raw Normal View History

2020-11-01 13:04:22 +01:00
#!/usr/bin/env sh
platforms() {
2020-11-01 13:14:04 +01:00
plat="$(grep '^[^#].*' < arch.txt)"
arch_count="$(echo "$plat" | wc -l)"
2020-11-01 13:04:22 +01:00
echo "$plat" | tr '\n' ',' | cut -d, -f1-$arch_count
}
create() {
docker buildx create --use
}
build() {
2020-11-01 13:14:04 +01:00
tagname="$1"
2020-11-01 13:04:22 +01:00
docker pull 'alpine:latest'
docker buildx build --push --tag="$tagname" --platform="$(platforms)" .
}
2020-11-01 13:14:04 +01:00
get_tag() {
git rev-parse --short HEAD
}
deploy() {
tag0="redxef/certbot-duckdns:$(get_tag)"
tag1="redxef/certbot-duckdns:latest"
build "$tag0"
build "$tag1"
}
2020-11-01 13:04:22 +01:00
"$@"