forked from ridiekel/jeletask
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release
executable file
·73 lines (58 loc) · 2.24 KB
/
release
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/env bash
mkdir -p /tmp/.m2
if ! docker run -it --rm \
-v "$PWD":/src \
-v "/var/run/docker.sock:/var/run/docker.sock" \
-v "/tmp/.m2":/root/.m2 \
-w /src \
maven:latest \
mvn versions:set; then
echo "Setting version failed!"
exit 255
fi
VERSION=$(grep "version>" jeletask2mqtt/pom.xml | head -1|cut -d'>' -f 2|cut -d'<' -f 1)
if ! docker run -it --rm \
-v "$PWD":/src \
-v "/var/run/docker.sock:/var/run/docker.sock" \
-v "/tmp/.m2":/root/.m2 \
-w /src \
maven:latest \
mvn clean install spring-boot:build-image; then
echo "Native build failed!"
exit 255
fi
if ! docker run -it --rm \
-v "$PWD":/src \
-v "/var/run/docker.sock:/var/run/docker.sock" \
-v "/tmp/.m2":/root/.m2 \
-w /src \
maven:latest \
mvn clean install; then
echo "Multi arch build failed!"
exit 255
fi
TMP_BUILD_DIR=/tmp/jeletaskbuild
rm -rf ${TMP_BUILD_DIR}
mkdir -p ${TMP_BUILD_DIR}/target
cp jeletask2mqtt-normal/target/jeletask2mqtt-normal-*.jar ${TMP_BUILD_DIR}/target
export BUILDPLATFORM=linux/arm64/v8
envsubst '${BUILDPLATFORM}' < jeletask2mqtt-normal/Dockerfile > ${TMP_BUILD_DIR}/Dockerfile
echo "---------------------------------------------------------------------"
cat ${TMP_BUILD_DIR}/Dockerfile
echo "---------------------------------------------------------------------"
(cd "${TMP_BUILD_DIR}" && docker buildx build --push \
-t ridiekel/jeletask2mqtt:latest-arm64 \
-t "ridiekel/jeletask2mqtt:$VERSION-arm64" \
--platform "${BUILDPLATFORM}" .)
export BUILDPLATFORM=linux/amd64
envsubst '${BUILDPLATFORM}' < jeletask2mqtt-normal/Dockerfile > ${TMP_BUILD_DIR}/Dockerfile
echo "---------------------------------------------------------------------"
cat ${TMP_BUILD_DIR}/Dockerfile
echo "---------------------------------------------------------------------"
(cd "${TMP_BUILD_DIR}" && docker buildx build --push \
-t ridiekel/jeletask2mqtt:latest-amd64 \
-t "ridiekel/jeletask2mqtt:$VERSION-amd64" \
--platform "${BUILDPLATFORM}" .)
docker push "ridiekel/jeletask2mqtt:$VERSION-native"
docker tag "ridiekel/jeletask2mqtt:$VERSION-native" ridiekel/jeletask2mqtt:latest-native
docker push ridiekel/jeletask2mqtt:latest-native