forked from confluentinc/schema-registry
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-build.sh
executable file
·52 lines (42 loc) · 1.17 KB
/
docker-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
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/sh
set -e -o pipefail
args=$(getopt EAH $*)
set -- $args
for i; do
case "$i"
in
-E)
ECR=true;
shift;;
-A)
AUTH=true;
shift;;
-H)
HUB=true;
shift;;
--)
shift;
break;;
esac
done
COMMIT_HASH=$(git rev-parse --short HEAD)
# Tag is composed with schema registry version and last commit.
BUILD_TAG=${BUILD_TAG:-"3.3.1-$COMMIT_HASH"}
BUILD_DIR=$(dirname $0)
# Build the latest & specific tag version image.
docker build -t pixability/confluent-schema-registry:latest \
-t pixability/confluent-schema-registry:$BUILD_TAG \
$BUILD_DIR
# Tag and push to ECR
# Tag and push to ECR
if [[ "$ECR" == "true" ]]; then
docker tag pixability/confluent-schema-registry:$BUILD_TAG 974422546278.dkr.ecr.us-east-1.amazonaws.com/pixability/confluent-schema-registry:$BUILD_TAG
if [[ "$AUTH" == "true" ]]; then
eval $(aws ecr get-login --no-include-email)
fi
docker push 974422546278.dkr.ecr.us-east-1.amazonaws.com/pixability/confluent-schema-registry:$BUILD_TAG
fi
# Push to docker hub
if [[ "$HUB" == "true" ]]; then
docker push pixability/confluent-schema-registry:$BUILD_TAG
fi