forked from domoticz/domoticz-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
38 lines (30 loc) · 1.37 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
set -e
BUILDX_PLATFORMS="linux/arm/v7,linux/arm64,linux/amd64"
curl -ksL https://releases.domoticz.com/releases/beta/version_linux_x86_64.h --output version.h
if [ $? -ne 0 ]
then
echo "Error downloading version file!";
exit 1
fi
curl -ksL https://releases.domoticz.com/releases/beta/history_linux_x86_64.txt --output history.h
if [ $? -ne 0 ]
then
echo "Error downloading version file!";
exit 1
fi
declare $(cat version.h | awk '{print $2"="$3}')
RELEASE_DATE="$(date -d @$APPDATE -u +"%Y-%m-%dT%H:%M:%SZ")"
VERSION_TAG_RAW=$(cat history.h | head -1 | awk '{print $2}')
IFS='.' read -r -a array <<< "$VERSION_TAG_RAW"
VERSION_TAG="${array[0]}"
echo "Building release $VERSION_TAG.$APPVERSION from commit $APPHASH ($RELEASE_DATE)";
# Remove double quotes in APPHASH
APPHASH="${APPHASH%\"}"
APPHASH="${APPHASH#\"}"
#docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker buildx rm domoticz_build >/dev/null 2>&1 || true
docker buildx create --name domoticz_build
docker buildx use domoticz_build
docker buildx inspect --bootstrap
echo "docker buildx build --push --no-cache --platform ${BUILDX_PLATFORMS} --build-arg APP_VERSION=$APPVERSION --build-arg APP_HASH=$APPHASH --build-arg BUILD_DATE=$RELEASE_DATE --tag domoticz/domoticz:latest --tag domoticz/domoticz:beta --tag domoticz/domoticz:$VERSION_TAG-beta.$APPVERSION ."