-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
34 lines (28 loc) · 1.13 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
set -eux
# ascii codes for colored output
YELLOW="\e[93m"
RED="\e[31m"
END="\e[0m"
echo -e "$YELLOW""Checking docker version...$END"
DOCKER_VERSION=$(docker --version)
if [ -z "$DOCKER_VERSION" ]; then
echo -e "$RED""You need to install docker!$END"
else
echo -e "$YELLOW""Found '$DOCKER_VERSION'. Continue build.$END"
fi
BUILD_DIR="build_dir"
function build_single_version() {
local VERSION_FEATURE_NAME=$1
local NEEDED_FILE=$2
local DOCKERFILE=$3
local TAG=$4
echo -e "$YELLOW""\nBuilding image for feature $VERSION_FEATURE_NAME, resulting file - $NEEDED_FILE.$END"
docker build --build-arg VERSION_FEATURE_NAME=$VERSION_FEATURE_NAME --build-arg NEEDED_FILE=$NEEDED_FILE -f "$DOCKERFILE" -t libmysqlclient-bindings:$TAG .
docker run --rm --entrypoint /bin/cat libmysqlclient-bindings:$TAG /$BUILD_DIR/$NEEDED_FILE > $PWD/src/$NEEDED_FILE
echo -e "$YELLOW""File saved at $PWD/src/$NEEDED_FILE.$END\n"
}
build_single_version "mysql" "mysql.rs" "mysql.dockerfile" "mysql"
sleep 5
build_single_version "mariadb" "mariadb.rs" "mariadb.dockerfile" "mariadb"
sleep 3
echo -e "$YELLOW""All versions are built.$END"