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

47 lines
1.1 KiB
Bash
Raw Permalink Normal View History

2024-09-17 14:11:00 +03:00
#!/bin/sh
set -ef
cd "$(dirname "$0")/.."
2024-11-08 14:19:37 +03:00
IMAGE_VERSION="${IMAGE_VERSION:-v0.0.6}"
2024-09-17 14:11:00 +03:00
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}"
2024-09-17 14:11:00 +03:00
## 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)
2024-09-17 14:11:00 +03:00
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"
;;
2024-09-17 14:11:00 +03:00
esac
buildah bud \
2024-09-17 14:11:00 +03:00
-f ./Dockerfile \
-t "${img_fq}" \
2024-09-17 14:11:00 +03:00
--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}"