-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·53 lines (48 loc) · 1.16 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
CONTAINER="dc-dec_onboarding"
REPOSITORY="oydeu"
TAG="latest"
# read commandline options
BUILD_CLEAN=false
DOCKER_UPDATE=false
BUILD_ARM=false
PLATFORM="linux/amd64"
BUILD_X86=true
DOCKERFILE="./docker/Dockerfile"
while [ $# -gt 0 ]; do
case "$1" in
--clean*)
BUILD_CLEAN=true
;;
--dockerhub*)
DOCKER_UPDATE=true
;;
--arm*)
BUILD_X86=false
BUILD_ARM=true
PLATFORM="linux/arm64"
DOCKERFILE="${DOCKERFILE}.arm64v8"
TAG="arm64v8"
;;
--x86*)
BUILD_X86=true
PLATFORM="linux/amd64"
;;
*)
printf "unknown option(s)\n"
if [ "${BASH_SOURCE[0]}" != "${0}" ]; then
return 1
else
exit 1
fi
esac
shift
done
if $BUILD_CLEAN; then
docker build --platform $PLATFORM --no-cache -f $DOCKERFILE -t $REPOSITORY/$CONTAINER:$TAG .
else
docker build --platform $PLATFORM -f $DOCKERFILE -t $REPOSITORY/$CONTAINER:$TAG .
fi
if $DOCKER_UPDATE; then
docker push $REPOSITORY/$CONTAINER:$TAG
fi