add build script and set docker labels with dyn. data

This commit is contained in:
Stefan Allius
2023-09-30 22:34:52 +02:00
parent 997195ea29
commit c773d5a084
2 changed files with 16 additions and 3 deletions

13
app/build.sh Executable file
View File

@@ -0,0 +1,13 @@
#!/bin/sh
BUILD_DATE=$(date -Iminutes)
VERSION=$(git describe --tags --abbrev=0)
VERSION="${VERSION:1}"
arr=(${VERSION//./ })
MAJOR=${arr[0]}
echo version: $VERSION build-date: $BUILD_DATE
exec docker build --label "org.label-schema.build-date=${BUILD_DATE}" --label "org.opencontainers.image.version=${VERSION}" \
-t "ghcr.io/s-allius/tsun-gen3-proxy:latest" -t "ghcr.io/s-allius/tsun-gen3-proxy:${MAJOR}" -t "ghcr.io/s-allius/tsun-gen3-proxy:${VERSION}" app
docker push ghcr.io/s-allius/tsun-gen3-proxy:latest
docker push ghcr.io/s-allius/tsun-gen3-proxy:${MAJOR}
docker push ghcr.io/s-allius/tsun-gen3-proxy:${VERSION}