1
0
angie-conv-image/build-scripts/image.sh

36 lines
895 B
Bash
Raw Normal View History

2024-07-11 13:37:35 +03:00
#!/bin/sh
set -ef
cd "$(dirname "$0")/.."
set -a
BUILDAH_FORMAT="${BUILDAH_FORMAT:-docker}"
BUILDAH_ISOLATION="${BUILDAH_ISOLATION:-chroot}"
BUILDAH_NETWORK="${BUILDAH_NETWORK:-host}"
set +a
ANGIE_VERSION="${ANGIE_VERSION:-1.6.0}"
## likely the same as in https://pkg.go.dev/strconv#ParseBool
gobool_to_int() {
## local value=$1
## local default=$2
case "${1:-_}" in
1 | [Tt] | [Tt][Rr][Uu][Ee] ) echo 1 ;;
0 | [Ff] | [Ff][Aa][Ll][Ss][Ee] ) echo 0 ;;
* ) echo "${2:-error}" ;;
esac
}
NGX_DEBUG=$(gobool_to_int "${1:-0}" 0)
case "${NGX_DEBUG}" in
0 ) img="docker.io/rockdrilla/angie-conv:${ANGIE_VERSION}-v1" ;;
1 ) img="docker.io/rockdrilla/angie-conv:debug-${ANGIE_VERSION}-v1" ;;
esac
exec buildah bud --network="${BUILDAH_NETWORK}" \
-f ./Dockerfile \
-t "${img}" \
--env "ANGIE_VERSION=${ANGIE_VERSION}" \
--env "NGX_DEBUG=${NGX_DEBUG}" \
--pull=missing --no-cache