-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
78 lines (73 loc) · 1.87 KB
/
build.sh
File metadata and controls
78 lines (73 loc) · 1.87 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/bash
banner() {
echo ""
echo " _ _ _ _ _ "
echo " | |__ _ _(_) | __| | ___| |__ "
echo " | '_ \| | | | | |/ _ | / __| _ \ "
echo " | |_) | |_| | | | (_| |_\__ \ | | |"
echo " |_.__/ \__,_|_|_|\__,_(_)___/_| |_|"
echo ""
}
# Define the usage function
usage() {
local custom_message="$1"
if [ -n "$custom_message" ]; then
echo "$custom_message"
echo ""
fi
echo "Usage: build.sh [OPTIONS] <image_type>"
echo ""
echo "Options:"
echo " -h, --help Print this message"
echo " -v, --version Print version"
echo ""
echo "Image Types:"
echo " latest Core image."
echo " bun Bun image."
echo " node Node.js image."
echo " php PHP image."
echo ""
exit 1
}
# Parse command line options
while [[ $# -gt 0 ]]; do
case "$1" in
-h|--help)
banner
usage
;;
-v|--version)
echo "build.sh version 1.0.0"
exit 0
;;
*)
break # Exit the option parsing loop if an argument is not an option
;;
esac
done
# Check if the script was called with arguments
if [ $# -eq 0 ]; then
banner
usage
fi
banner
# Check for the image type
case "$1" in
latest)
docker buildx build -t codjix/devbox:latest -f ./src/latest/Dockerfile .
;;
bun)
docker buildx build -t codjix/devbox:bun -f ./src/bun/Dockerfile .
;;
node)
docker buildx build -t codjix/devbox:node -f ./src/node/Dockerfile .
;;
php)
docker buildx build -t codjix/devbox:php -f ./src/php/Dockerfile .
;;
*)
# Invalid image type
usage "Invalid option or image type: $1"
exit 1
;;
esac