-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·66 lines (61 loc) · 1.68 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
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
CONTAINER="dc-intermediary"
REPOSITORY="oydeu"
TAG="latest"
# read commandline options
BUILD_CLEAN=false
DOCKER_UPDATE=false
BUILD_ARM=false
PLATFORM="linux/amd64"
BUILD_X86=true
BUILD_LOCAL=false
DEBUG_OPTION=""
DOCKERFILE="./docker/Dockerfile"
while [ $# -gt 0 ]; do
case "$1" in
--local*)
# setopt localoptions rmstarsilent
rm -f docker/local-gem/*
cp ~/dev/semcon/ruby-gem/pkg/semcon-`cat ~/dev/semcon/ruby-gem/VERSION`.gem docker/local-gem
cp ~/dev/oydid/ruby-gem/pkg/oydid-`cat ~/dev/oydid/ruby-gem/VERSION`.gem docker/local-gem
BUILD_LOCAL=true
DOCKERFILE="${DOCKERFILE}-local"
;;
--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"
;;
--debug*)
DEBUG_OPTION="--progress=plain"
;;
*)
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 $DEBUG_OPTION --platform $PLATFORM --no-cache -f $DOCKERFILE -t $REPOSITORY/$CONTAINER:$TAG .
else
docker build $DEBUG_OPTION --platform $PLATFORM -f $DOCKERFILE -t $REPOSITORY/$CONTAINER:$TAG .
fi
if $DOCKER_UPDATE; then
docker push $REPOSITORY/$CONTAINER:$TAG
fi