add ability to build local variants from a ./.code directory
This commit is contained in:
12
build.sh
12
build.sh
@@ -2,7 +2,7 @@
|
||||
set -euo pipefail
|
||||
shopt -s extglob
|
||||
|
||||
cd "$(dirname "$0")"
|
||||
readonly DIR="$(cd "$(dirname "$0")"; pwd)"
|
||||
|
||||
if (( $# == 0 )); then
|
||||
readonly images=(core basic !(template|core|basic)/)
|
||||
@@ -11,5 +11,13 @@ else
|
||||
fi
|
||||
|
||||
for image in "${images[@]}"; do
|
||||
podman build -t "code-${image%/}" -f "${image%/}/Containerfile"
|
||||
if [[ "$image" == '.' ]]; then
|
||||
tag="$(basename "$(pwd)")"
|
||||
contdir='.code'
|
||||
else
|
||||
tag="$image"
|
||||
contdir="$DIR/${image%/}"
|
||||
fi
|
||||
|
||||
podman build -t "code-${tag}" -f "${contdir}/Containerfile"
|
||||
done
|
||||
|
||||
11
code
11
code
@@ -25,19 +25,18 @@ readonly DIR="$(dirname "$(readlink -f -- "$0")")"
|
||||
ports=()
|
||||
loopback=false
|
||||
variant="$DEFAULT_VARIANT"
|
||||
variants=($(
|
||||
podman image list code- -n | sed -n 's|^[^ ]\+/code-\([^ ]\+\) .*|\1|p'
|
||||
))
|
||||
|
||||
for arg in "$@"; do
|
||||
case "$arg" in
|
||||
--publish ) shift; ports+=("$1");;
|
||||
--loopback ) loopback=true;;
|
||||
--variants )
|
||||
for f in "$DIR"/*; do
|
||||
[[ "$f" == */template || ! -d "$f" ]] || echo "${f##*/}";
|
||||
done
|
||||
exit;;
|
||||
--variants ) printf '%s\n' "${variants[@]}"; exit;;
|
||||
-h | --help ) echo >&2 "$HELP"; exit;;
|
||||
--* )
|
||||
if [[ ! -d "${DIR}/${arg#--}" ]]; then break; fi
|
||||
[[ " ${variants[*]} " == *" ${arg#--} "* ]] || break
|
||||
variant="${arg#--}";;
|
||||
* ) break;;
|
||||
esac
|
||||
|
||||
Reference in New Issue
Block a user