1
0
angie-conv-image/build-scripts/image.sh
2024-09-17 14:11:00 +03:00

36 lines
872 B
Bash
Executable File

#!/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.2}"
## 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:v0.0.1-${ANGIE_VERSION}" ;;
1 ) img="docker.io/rockdrilla/angie-conv:v0.0.1-${ANGIE_VERSION}-debug" ;;
esac
exec buildah bud \
-f ./Dockerfile \
-t "${img}" \
--env "ANGIE_VERSION=${ANGIE_VERSION}" \
--env "NGX_DEBUG=${NGX_DEBUG}" \
--pull=missing --no-cache