-
-
Notifications
You must be signed in to change notification settings - Fork 241
Expand file tree
/
Copy pathbuild-mongodb-multiplatform.sh
More file actions
executable file
·65 lines (53 loc) · 1.75 KB
/
build-mongodb-multiplatform.sh
File metadata and controls
executable file
·65 lines (53 loc) · 1.75 KB
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
#!/bin/bash
set -eo pipefail
function usage() {
MSG=$1
echo ""
echo "$MSG"
echo ""
echo "Usage: build-mongodb-multiplatform <release version> <base version> <platform>";
echo ""
echo " Where platform can be for example:"
echo " linux/amd64"
echo " linux/amd64,linux/arm64"
echo " linux/arm64"
echo ""
exit 1;
}
if [[ -z "$1" ]]; then
usage "A release version must be specified."
fi
if [[ -z "$2" ]]; then
usage "A base version must be specified."
fi
if [[ -z "$3" ]]; then
usage "Platform must be specified."
fi
PLATFORM=$3
if [ -z "${DEBEZIUM_DOCKER_REGISTRY_PRIMARY_NAME}" ]; then
DEBEZIUM_DOCKER_REGISTRY_PRIMARY_NAME=quay.io/debezium
fi;
echo ""
echo "****************************************************************"
echo "** Building ${DEBEZIUM_DOCKER_REGISTRY_PRIMARY_NAME}/mongo:$1 based on mongo version $2 for $PLATFORM"
echo "****************************************************************"
TAGS+=("-t ${DEBEZIUM_DOCKER_REGISTRY_PRIMARY_NAME}/mongo:$1")
if [ -n "${DEBEZIUM_DOCKER_REGISTRY_SECONDARY_NAME}" ]; then
TAGS+=("-t ${DEBEZIUM_DOCKER_REGISTRY_SECONDARY_NAME}/mongo:$1")
fi;
PUSH_FLAG="--push"
if [[ "$DRY_RUN" == "true" ]]; then
PUSH_FLAG=""
fi
echo "****************************************************************"
echo "Running docker buildx build $PUSH_FLAG --platform \"${PLATFORM}\" \
--progress=plain \
--build-arg IMAGE_TAG=\"$2\" \
${TAGS[*]} \
\"mongo/$1\""
echo "****************************************************************"
# shellcheck disable=SC2068
docker buildx build $PUSH_FLAG --platform "${PLATFORM}" \
--build-arg IMAGE_TAG="$2" \
${TAGS[@]} \
"mongo/$1"