mirror of
https://github.com/avatao-content/test-tutorial-framework
synced 2024-11-15 01:17:16 +00:00
49 lines
1.4 KiB
Bash
49 lines
1.4 KiB
Bash
# Requires context:
|
|
# - BASEIMAGE_PATH: absolute path of baseimage repo
|
|
# - BASEIMAGE_REPO: basename of baseimage repo
|
|
|
|
BASEIMAGE_NAME="${BASEIMAGE_NAME:-avatao/baseimage-tutorial-framework}"
|
|
|
|
libhack_dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
|
|
source "${libhack_dir}/common.sh"
|
|
|
|
|
|
baseimage::build() {
|
|
baseimage::assert_exists
|
|
pushd "${BASEIMAGE_PATH}"
|
|
local tag
|
|
tag="${BASEIMAGE_NAME}:$(releasename)"
|
|
docker build --build-arg FRONTEND_VERSION="${frontend_version}" \
|
|
-t "${tag}" \
|
|
.
|
|
docker tag "${tag}" "${BASEIMAGE_NAME}:latest"
|
|
popd
|
|
}
|
|
|
|
baseimage::assert_exists() {
|
|
if ! baseimage::check_exists; then
|
|
printf "Cannot find baseimage at ${BASEIMAGE_PATH}!\n"
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
baseimage::check_exists() {
|
|
[[ -d "${BASEIMAGE_PATH}" ]]
|
|
}
|
|
|
|
baseimage::release() {
|
|
baseimage::assert_exists
|
|
pushd "${BASEIMAGE_PATH}"
|
|
local tag
|
|
tag="$(releasename)"
|
|
read -p "Tag and push baseimage \"${tag}\"? [y/N]" -r && echo
|
|
if [[ $REPLY =~ ^(y|Y|yes|Yes|YES)$ ]]; then
|
|
printf "Pushing git tag to upstream...\n"
|
|
tag="${tag}" description="${tag}" force_push_tag
|
|
printf "\nPushing image to DockerHub...\n"
|
|
docker push "${BASEIMAGE_NAME}:${tag}"
|
|
docker push "${BASEIMAGE_NAME}:latest"
|
|
fi
|
|
popd
|
|
}
|