release script fixes

This commit is contained in:
Scott Lamb 2021-03-12 13:33:08 -08:00
parent d5320302a3
commit 6f2befec65
2 changed files with 21 additions and 14 deletions

View File

@ -132,7 +132,7 @@ Releases are currently a bit manual. From a completely clean git work tree,
git tag -a "v${VERSION}" -m "version ${VERSION}"
./release.bash
git push
git push "v${VERSION}"
git push origin "v${VERSION}"
```
The `release.bash` script needs [`jq`](https://stedolan.github.io/jq/)

View File

@ -14,9 +14,24 @@ set_latest() {
# "docker tag" won't copy those. The technique below is adopted from here:
# https://github.com/docker/buildx/issues/459#issuecomment-750011371
local image="$1"
local hashes="$(docker manifest inspect "${image}:${version}" |
jq --raw-output '.manifests[].digest')"
time docker manifest create "${image}:latest" "${hashes[@]/#/${image}:}"
local hashes=($(docker manifest inspect "${image}:${version}" |
jq --raw-output '.manifests[].digest'))
time docker manifest rm "${image}:latest" || true
time docker manifest create \
"${image}:latest" \
"${hashes[@]/#/${image}@}"
time docker manifest push "${image}:latest"
}
build_and_push() {
local image="$1"
local target="$2"
time docker buildx build \
--push \
--tag="${image}:${version}" \
--target="${target}" \
--platform=linux/amd64,linux/arm64/v8,linux/arm/v7 \
-f docker/Dockerfile .
}
version="$(git describe --dirty)"
@ -30,15 +45,7 @@ if [[ -n "$(git status --porcelain)" ]]; then
exit 1
fi
time docker buildx build \
--push \
--tag="scottlamb/moonfire-nvr:${version}" \
-f docker/Dockerfile .
time docker buildx build \
--push \
--tag="scottlamb/moonfire-dev:${version}" \
--target="dev" \
-f docker/Dockerfile .
build_and_push scottlamb/moonfire-nvr deploy
build_and_push scottlamb/moonfire-dev dev
set_latest scottlamb/moonfire-nvr
set_latest scottlamb/moonfire-dev