openreplay/backend/build.sh
Rajesh Rajendran c8c0b7c0d4
chore(build): custom image tag
Signed-off-by: Rajesh Rajendran <rjshrjndrn@gmail.com>
2021-05-12 15:57:20 +05:30

40 lines
947 B
Bash

#!/bin/bash
# Script to build api module
# flags to accept:
# ee: build for enterprize edition.
# Default will be OSS build.
# Example
# DOCKER_REPO=asayer.io bash buid.sh
git_sha1=${IMAGE_TAG:-$(git rev-parse HEAD)}
ee="false"
check_prereq() {
which docker || {
echo "Docker not installed, please install docker."
exit=1
}
[[ exit -eq 1 ]] && exit 1
}
function build_api(){
# Copy enterprize code
[[ $1 == "ee" ]] && {
cp -r ../ee/backend/* ./
ee="true"
}
[[ $2 != "" ]] && {
image="$2"
docker build -t ${DOCKER_REPO:-'local'}/$image:${git_sha1} --build-arg SERVICE_NAME=$image .
return
}
for image in $(ls services);
do
docker build -t ${DOCKER_REPO:-'local'}/$image:${git_sha1} --build-arg SERVICE_NAME=$image .
echo "::set-output name=image::${DOCKER_REPO:-'local'}/$image:${git_sha1}"
done
}
check_prereq
build_api $1 $2