-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathci-mock.sh
More file actions
executable file
·36 lines (29 loc) · 772 Bytes
/
ci-mock.sh
File metadata and controls
executable file
·36 lines (29 loc) · 772 Bytes
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
#!/usr/bin/env bash
repository="morbargig/echo-app"
branch="master"
version=""
commit=$(cat /dev/urandom | env LC_CTYPE=C tr -dc 'a-zA-Z0-9' | fold -w 8 | head -n 1 | awk '{print tolower($0)}')
while getopts :r:b:v: o; do
case "${o}" in
r)
repository=${OPTARG}
;;
b)
branch=${OPTARG}
;;
v)
version=${OPTARG}
;;
esac
done
shift $((OPTIND-1))
if [ -z "${version}" ]; then
image="${repository}:${branch}-${commit}"
version="0.4.0"
else
image="${repository}:${version}"
fi
echo ">>>> Building image ${image} <<<<"
docker build --build-arg GITCOMMIT=${commit} --build-arg VERSION=${version} -t ${image} -f Dockerfile .
echo ${image}
docker push ${image}