From c773d5a0846135ac938d566466a16ee90cc11805 Mon Sep 17 00:00:00 2001 From: Stefan Allius Date: Sat, 30 Sep 2023 22:34:52 +0200 Subject: [PATCH] add build script and set docker labels with dyn. data --- app/Dockerfile | 6 +++--- app/build.sh | 13 +++++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) create mode 100755 app/build.sh diff --git a/app/Dockerfile b/app/Dockerfile index f3c05b3..91a292f 100644 --- a/app/Dockerfile +++ b/app/Dockerfile @@ -68,9 +68,9 @@ EXPOSE 5005 ENTRYPOINT ["/root/entrypoint.sh"] CMD [ "python3", "./server.py" ] -LABEL org.label-schema.build-date=$BUILD_DATE -LABEL org.opencontainers.image.authors="Stefan Allius " + +LABEL org.opencontainers.image.authors="Stefan Allius" LABEL org.opencontainers.image.source https://github.com/s-allius/tsun-gen3-proxy LABEL org.opencontainers.image.description 'The "TSUN Gen3 Micro-Inverter" proxy enables a reliable connection between TSUN third generation inverters and an MQTT broker to integrate the inverter into typical home automations' LABEL org.opencontainers.image.licenses="BSD-3-Clause" -LABEL org.opencontainers.image.vendor="Stefan Allius>" +LABEL org.opencontainers.image.vendor="Stefan Allius" diff --git a/app/build.sh b/app/build.sh new file mode 100755 index 0000000..95adfbb --- /dev/null +++ b/app/build.sh @@ -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} \ No newline at end of file