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

47 lines
1.1 KiB
Bash
Executable File

#!/bin/sh
set -ef
cd "$(dirname "$0")/.."
IMAGE_VERSION="${IMAGE_VERSION:-v0.0.7}"
set -a
BUILDAH_FORMAT="${BUILDAH_FORMAT:-docker}"
BUILDAH_ISOLATION="${BUILDAH_ISOLATION:-chroot}"
BUILDAH_NETWORK="${BUILDAH_NETWORK:-host}"
set +a
ANGIE_VERSION="${ANGIE_VERSION:-1.7.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 "${NGX_DEBUG:-0}" 0)
case "${NGX_DEBUG}" in
0 )
img="docker.io/rockdrilla/angie-conv:${IMAGE_VERSION}"
img_fq="docker.io/rockdrilla/angie-conv:${IMAGE_VERSION}-${ANGIE_VERSION}"
;;
1 )
img="docker.io/rockdrilla/angie-conv:${IMAGE_VERSION}-debug"
img_fq="docker.io/rockdrilla/angie-conv:${IMAGE_VERSION}-${ANGIE_VERSION}-debug"
;;
esac
buildah bud \
-f ./Dockerfile \
-t "${img_fq}" \
--env "ANGIE_VERSION=${ANGIE_VERSION}" \
--env "NGX_DEBUG=${NGX_DEBUG}" \
--pull=missing --no-cache \
--build-arg "IMAGE_VERSION=${IMAGE_VERSION}" \
podman tag "${img_fq}" "${img}"