@@ -48,22 +48,19 @@ add_entrypoint() {
48
48
tag=$tag -$4
49
49
fi
50
50
tag=$tag -$3
51
- containerfile=$( mktemp)
52
- cat > " ${containerfile} " << EOF
53
- FROM $2
54
- ENTRYPOINT [ "/usr/bin/$3 .sh" ]
55
- EOF
56
- echo " $1 build ${nocache} -t $tag -f ${containerfile} ."
57
- eval " $1 build ${nocache} -t $tag -f ${containerfile} ."
58
- rm " ${containerfile} "
51
+ containerfile=" container-images/common/Containerfile.entrypoint"
52
+ build_args=(" --build-arg" " PARENT=$2 " " --build-arg" " ENTRYPOINT=/usr/bin/${3} .sh" )
53
+ echo " $1 build ${nocache} ${build_args[*]} -t $tag -f ${containerfile} ."
54
+ eval " $1 build ${nocache} ${build_args[*]} -t $tag -f ${containerfile} ."
59
55
}
60
56
61
57
add_rag () {
62
58
tag=" $2 "
63
59
if [ -n " $3 " ]; then
64
60
tag=$tag -$3
65
61
fi
66
- containerfile=$( mktemp)
62
+ tag=$tag -rag
63
+ containerfile=" container-images/common/Containerfile.rag"
67
64
GPU=cpu
68
65
case $2 in
69
66
cuda)
@@ -79,17 +76,9 @@ add_rag() {
79
76
GPU=cpu
80
77
;;
81
78
esac
82
- cat > " ${containerfile} " << EOF
83
- ARG REGISTRY_PATH=quay.io/ramalama
84
- FROM ${REGISTRY_PATH} /$2
85
-
86
- USER root
87
- RUN /usr/bin/build_rag.sh ${GPU}
88
- ENTRYPOINT []
89
- EOF
90
- echo " $1 build ${nocache} -t ${REGISTRY_PATH} /$tag -rag -f ${containerfile} ."
91
- eval " $1 build ${nocache} -t ${REGISTRY_PATH} /$tag -rag -f ${containerfile} ."
92
- rm " ${containerfile} "
79
+ build_args=(" --build-arg" " PARENT=$2 " " --build-arg" " GPU=$GPU " )
80
+ echo " $1 build ${nocache} ${build_args[*]} -t $tag -f ${containerfile} ."
81
+ eval " $1 build ${nocache} ${build_args[*]} -t $tag -f ${containerfile} ."
93
82
}
94
83
95
84
add_entrypoints () {
@@ -121,7 +110,7 @@ build() {
121
110
* )
122
111
if [ " ${build_all} " -eq 1 ]; then
123
112
add_entrypoints " ${conman[@]} " " ${REGISTRY_PATH} " /" ${target} " " ${version} "
124
- add_rag " ${conman[@]} " " ${target} " " ${version} "
113
+ add_rag " ${conman[@]} " " ${REGISTRY_PATH} " / " ${ target}" " ${version} "
125
114
rm_container_image
126
115
fi
127
116
esac
@@ -215,7 +204,7 @@ process_all_targets() {
215
204
for i in ./container-images/* ; do
216
205
i=$( basename " $i " )
217
206
# skip these directories
218
- if [[ " $i " =~ ^(scripts| ramalama)$ ]]; then
207
+ if [[ " $i " =~ ^(scripts| ramalama| common )$ ]]; then
219
208
continue
220
209
fi
221
210
0 commit comments