-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.sh
executable file
·43 lines (36 loc) · 936 Bytes
/
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
#!/bin/bash
#
# Copyright (c) 2021 - for information on the respective copyright owner
# see the NOTICE file and/or the repository https://github.com/carbynestack/base-images.
#
# SPDX-License-Identifier: Apache-2.0
#
REPOSITORY="ghcr.io/carbynestack"
VERSION="0.6"
buildImage() {
docker build -f ${1} . --build-arg VERSION=${VERSION} -t ${REPOSITORY}/${2}:${3}
}
while [ $# -gt 0 -a "$1" != "" ]; do
case $1 in
-v | --version)
VERSION="$2"
shift
;;
-r | --repository)
REPOSITORY="$2"
shift
;;
*)
echo Invalid option \"$1\"
exit 1
;;
esac
shift
done
DOCKERFILES=($(find . -maxdepth 1 -type f -iname "Dockerfile.*"))
for DOCKERFILE in "${DOCKERFILES[@]}" ; do
NAME=$(grep -m 1 "ARG ARTIFACT_NAME" ${DOCKERFILE} | sed 's/.*\"\(.*\)\"/\1/g')
TAG=$(grep -m 1 "ARG ARTIFACT_TAG" ${DOCKERFILE} | sed 's/.*\"\(.*\)\"/\1/g')
buildImage ${DOCKERFILE} ${NAME} ${TAG}
done
exit