-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sh
executable file
·39 lines (33 loc) · 940 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
#!/bin/bash
SCRIPT="$(readlink -f "$0")"
ROOT="$(dirname "$SCRIPT")"
GIT_TAG=$(git tag -l --points-at HEAD)
DOCKER_TAG=latest
BUILD_FLAGS=""
BUILD_TARGET="debug"
for arg in "$@"
do
case "$arg" in
--release)
BUILD_FLAGS="--release"
BUILD_TARGET="release"
if [[ -n "$GIT_TAG" ]]; then
# release mode and has a git tag => tag the image with the version
DOCKER_TAG="$GIT_TAG"
fi
;;
*)
printf "***************************\n"
printf "* Error: Invalid argument: $arg\n"
printf "***************************\n"
exit 1
esac
done
docker build --tag "cenotelie/croixrouge:latest" --rm \
--build-arg="BUILD_FLAGS=$BUILD_FLAGS" \
--build-arg="BUILD_TARGET=$BUILD_TARGET" \
"$ROOT"
if [[ "$DOCKER_TAG" != "latest" ]]; then
# specific tag for release
docker tag "cenotelie/croixrouge:latest" "cenotelie/croixrouge:$DOCKER_TAG"
fi