devbox/build-image.fish
2026-03-17 12:15:07 -07:00

49 lines
1.4 KiB
Fish

# Build script for the devcontainer image.
set -f DEFAULT_TAG 'devbox:questing'
set -f DEFAULT_BASE 'ubuntu:25.10'
set -f DEFAULT_USERNAME brent
set -f DEFAULT_FULL_NAME 'Brent Schroeter'
argparse -S 'b/base=' 't/tag=' 'u/username=' 'email=' 'full-name=' no-cache -- $argv
or return 1
if not set -ql _flag_tag
set -f _flag_tag "$DEFAULT_TAG"
end
if not set -ql _flag_base
set -f _flag_base "$DEFAULT_BASE"
end
if not set -ql _flag_username
set -f _flag_username "$DEFAULT_USERNAME"
end
if not set -ql _flag_full_name
set -f _flag_full_name "$DEFAULT_FULL_NAME"
end
if not set -ql _flag_email
echo '--email is required for VCS configuration' >&2
return 1
end
echo "Build configuration:"
echo " base = $_flag_base"
echo " tag = $_flag_tag"
echo " username = $_flag_username"
echo " email = $_flag_email"
echo " full_name = $_flag_full_name"
if set -ql _flag_no_cache
container build --no-cache -t "$_flag_tag" \
--build-arg "BASE_IMAGE=$_flag_base" \
--build-arg "USERNAME=$_flag_username" \
--build-arg "VCS_EMAIL=$_flag_email" \
--build-arg "VCS_NAME=$_flag_full_name" \
.
else
container build -t "$_flag_tag" \
--build-arg "BASE_IMAGE=$_flag_base" \
--build-arg "USERNAME=$_flag_username" \
--build-arg "VCS_EMAIL=$_flag_email" \
--build-arg "VCS_NAME=$_flag_full_name" \
.
end