-
Notifications
You must be signed in to change notification settings - Fork 24
/
build.sh
executable file
·40 lines (36 loc) · 885 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
#!/bin/bash
Cyan='\033[0;36m'
Red='\033[0;31m'
Green='\033[0;32m'
help() {
echo ""
echo "build.sh - Script to build and push a Dockerfile to a repository."
echo ""
echo "Usage:"
echo "./build.sh <repository_name> <tag>"
echo ""
echo "Example: To build an image tagged 'dev' for DockerHub on my account:"
echo "./build.sh mbagnall dev\n"
echo ""
echo "Example: To build an image tagged 'dev' on a private registry with"
echo "the 'probo' namespace:"
echo "./build.sh docker.example.com/probo dev"
echo ""
exit 1;
}
if [ -n "$2" ]; then
export tag=$2
else
help
fi
if [ -z "$1" ]; then
help
fi
printf "${Cyan}Building Probo..............................."
stuff=`docker buildx build --quiet --platform linux/amd64,linux/arm64 -t $1/probo:$tag --push .`;
if [[ $? == 0 ]]; then
printf "${Green}[ok]\n";
else
printf "${Red}[error]\n";
exit 1;
fi