-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathbuild.sh
executable file
·50 lines (44 loc) · 1.52 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
#!/bin/bash
######################################################################
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
# SPDX-License-Identifier: MIT-0 #
######################################################################
print_help() {
echo ""
echo "Usage: $0 [arg]"
echo ""
echo " When no arguments are specified, this script builds a base container "
echo " for the processor type, configured in config.properties."
echo " Optionally, the script can push/pull the base image to/from a container registry."
echo ""
echo " Available optional arguments:"
echo " push - push base image to container registry"
echo " pull - pull base image from container registry"
echo ""
}
action=$1
if [ "$action" == "" ]; then
source ./config.properties
echo ""
echo "Building base container ..."
echo ""
dockerfile=./1-build/Dockerfile-base-${processor}
if [ -f $dockerfile ]; then
echo " ... base-${processor} ..."
CMD="docker build -t ${registry}${base_image_name}${base_image_tag} -f $dockerfile ."
if [ ! "$verbose" == "false" ]; then
echo -e "\n${CMD}\n"
fi
eval "${CMD}"
else
echo "Dockerfile $dockerfile was not found."
echo "Please ensure that processor is configured with a supported value in config.properties"
exit 1
fi
elif [ "$action" == "push" ]; then
./1-build/push.sh
elif [ "$action" == "pull" ]; then
./-build/pull.sh
else
print_help
fi