mirror of
https://github.com/avatao-content/test-tutorial-framework
synced 2025-06-28 10:25:12 +00:00
Improve tfw.sh (refactor & new baseimage compliance)
This commit is contained in:
@ -8,23 +8,32 @@ libhack_dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
|
||||
source "${libhack_dir}/common.sh"
|
||||
|
||||
|
||||
baseimage::assert_exists() {
|
||||
if [[ ! -d "${BASEIMAGE_PATH}" ]]; then
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
baseimage::build_if_exists() {
|
||||
[[ ! -d "${BASEIMAGE_PATH}" ]] && return ||:
|
||||
baseimage::build
|
||||
}
|
||||
|
||||
baseimage::build() {
|
||||
baseimage::assert_exists
|
||||
pushd "${BASEIMAGE_PATH}"
|
||||
local tag
|
||||
tag="${BASEIMAGE_NAME}:$(releasename)"
|
||||
docker build -t "${tag}" .
|
||||
docker build --build-arg FRONTEND_VERSION="${frontend_version}" \
|
||||
-t "${tag}" \
|
||||
.
|
||||
docker tag "${tag}" "${BASEIMAGE_NAME}:latest"
|
||||
popd
|
||||
}
|
||||
|
||||
baseimage::assert_exists() {
|
||||
if [[ ! -d "${BASEIMAGE_PATH}" ]]; then
|
||||
printf "Cannot find baseimage at ${BASEIMAGE_PATH}!\n"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
baseimage::release() {
|
||||
baseimage::assert_exists
|
||||
pushd "${BASEIMAGE_PATH}"
|
||||
local tag
|
||||
tag="$(releasename)"
|
||||
|
@ -7,19 +7,22 @@ libhack_dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
|
||||
source "${libhack_dir}/common.sh"
|
||||
|
||||
|
||||
frontend::assert_exists() {
|
||||
if [[ ! -d "${FRONTEND_PATH}" ]]; then
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
frontend::build() {
|
||||
frontend::assert_exists
|
||||
pushd "${FRONTEND_PATH}"
|
||||
docker build -t "${FRONTEND_IMAGE_NAME}:$(releasename)" .
|
||||
popd
|
||||
}
|
||||
|
||||
frontend::assert_exists() {
|
||||
if [[ ! -d "${FRONTEND_PATH}" ]]; then
|
||||
printf "Cannot find frontend at ${FRONTEND_PATH}!\n"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
frontend::release() {
|
||||
frontend::assert_exists
|
||||
pushd "${FRONTEND_PATH}"
|
||||
local tag
|
||||
tag="$(releasename)"
|
||||
@ -32,3 +35,10 @@ frontend::release() {
|
||||
fi
|
||||
popd
|
||||
}
|
||||
|
||||
frontend::latest_tag() {
|
||||
frontend::assert_exists
|
||||
pushd "${FRONTEND_PATH}"
|
||||
git describe --tags
|
||||
popd
|
||||
}
|
||||
|
Reference in New Issue
Block a user