-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbake
executable file
·110 lines (86 loc) · 2.61 KB
/
bake
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/bin/bash
set -Eeuo pipefail
_command=${1:-"help"}
_root_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
_bold="\033[1m"
_normal="\033[0m"
_help="
${_bold}SYNOPSIS${_normal}
./bake [OPTION] [ARGUMENT]
${_bold}DESCRIPTION${_normal}
${_bold}help${_normal}
display this help and exit
${_bold}build [image-name]${_normal}
builds selected docker image
"
help() {
echo -e "$_help"
}
build() {
local _help="
${_bold}Usage:${_normal} ./bake build [image]
Build selected docker image
${_bold}Images:${_normal}
software
base-os
final-os
installer
installed
final
"
local image=${1:-""}
case $image in
software)
docker build \
-t ipc_lab/ipc:software \
-f ${_root_dir}/informatica/software/Dockerfile ${_root_dir}/informatica/software
;;
base-os)
docker build \
--target base-os \
--cache-from ipc_lab/ipc:base-os \
-t ipc_lab/ipc:base-os \
-f ${_root_dir}/informatica/Dockerfile ${_root_dir}/informatica
;;
final-os)
docker build \
--target final-os \
--cache-from ipc_lab/ipc:base-os \
--cache-from ipc_lab/ipc:final-os \
-t ipc_lab/ipc:final-os \
-f ${_root_dir}/informatica/Dockerfile ${_root_dir}/informatica
;;
installer)
docker build \
--target installer \
--cache-from ipc_lab/ipc:base-os \
--cache-from ipc_lab/ipc:installer \
-t ipc_lab/ipc:installer \
-f ${_root_dir}/informatica/Dockerfile ${_root_dir}/informatica
;;
installed)
docker build \
--target installed \
--cache-from ipc_lab/ipc:base-os \
--cache-from ipc_lab/ipc:installer \
--cache-from ipc_lab/ipc:installed \
-t ipc_lab/ipc:installed \
-f ${_root_dir}/informatica/Dockerfile ${_root_dir}/informatica
;;
final)
docker build \
--target final \
--cache-from ipc_lab/ipc:base-os \
--cache-from ipc_lab/ipc:final-os \
--cache-from ipc_lab/ipc:installer \
--cache-from ipc_lab/ipc:installed \
--cache-from ipc_lab/ipc:final \
-t ipc_lab/ipc:final \
-f ${_root_dir}/informatica/Dockerfile ${_root_dir}/informatica
;;
*)
echo -e "${_help}"
;;
esac
}
$_command ${@:2}