-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sh
executable file
·56 lines (43 loc) · 1.11 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
#!/bin/bash
# error codes
# 2 Invalid base image
declare -A base_image_tags
base_image_tags[stable]=debian:stable-slim
base_image_tags[bookworm]=debian:bookworm-slim
base_image_tags[bullseye]=debian:bullseye-slim
declare -A local_tag
local_tag[stable]=local-stable
local_tag[bookworm]=local-bookworm
local_tag[bullseye]=local-bullseye
DEFAULT_BASE_IMAGE=stable
DEFAULT_TAG=local
tag=""
git_branch="$DEFAULT_GIT_VERSION"
while getopts b:t:p: flag
do
case "${flag}" in
b) base_image_tag=${OPTARG};;
t) tag=${OPTARG};;
esac
done
echo "base_image_tag: $base_image_tag";
echo "tag: $tag";
if [ -z "${base_image_tag}" ]; then
base_image_tag=$DEFAULT_BASE_IMAGE
fi
selected_image_tag=${base_image_tags[$base_image_tag]}
if [ -z "${selected_image_tag}" ]; then
echo "invalid base image ["${base_image_tag}"]"
exit 2
fi
select_tag=${local_tag[$base_image_tag]}
if [[ -n "$select_tag" ]]; then
tag=$select_tag
else
tag=$DEFAULT_TAG
fi
echo "Base Image Tag: [$selected_image_tag]"
echo "Build Tag: [$tag]"
docker build . \
--build-arg BASE_IMAGE=${selected_image_tag} \
-t giof71/roon-bridge:$tag