-
Notifications
You must be signed in to change notification settings - Fork 232
/
build-postgres-multiplatform.sh
executable file
·47 lines (39 loc) · 1.22 KB
/
build-postgres-multiplatform.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
39
40
41
42
43
44
45
46
47
#!/bin/bash
set -eo pipefail
function usage() {
MSG=$1
echo ""
echo "$MSG"
echo ""
echo "Usage: build-postgres-multiplatform <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 version must be specified."
fi
if [[ -z "$2" ]]; then
usage "Platform must be specified."
fi
PLATFORM=$2
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}/postgres:$1 for $PLATFORM"
echo "****************************************************************"
TAGS+=("-t ${DEBEZIUM_DOCKER_REGISTRY_PRIMARY_NAME}/postgres:$1")
if [ -n "${DEBEZIUM_DOCKER_REGISTRY_SECONDARY_NAME}" ]; then
TAGS+=("-t ${DEBEZIUM_DOCKER_REGISTRY_SECONDARY_NAME}/postgres:$1")
fi;
# shellcheck disable=SC2068
docker buildx build --push --platform "${PLATFORM}" \
--build-arg DEBEZIUM_DOCKER_REGISTRY_PRIMARY_NAME="${DEBEZIUM_DOCKER_REGISTRY_PRIMARY_NAME}" \
${TAGS[@]} \
"postgres/$1"