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

View File

@@ -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 <stefan.allius@t-online.de>"
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"

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}