devbox/build-image.fish

55 lines
1.5 KiB
Fish
Raw Normal View History

2026-03-17 11:47:59 -07:00
# 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'
2026-07-11 21:01:58 -07:00
argparse -S 'b/base=' 't/tag=' 'u/username=' 'email=' 'full-name=' 'runtime=' no-cache -- $argv
2026-03-17 11:47:59 -07:00
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
2026-07-11 21:01:58 -07:00
if not set -ql _flag_runtime
set -f _flag_runtime container
end
if test "$_flag_runtime" != docker -a "$_flag_runtime" != container
echo '--runtime must be one of "docker" or "container"'
return 1
end
2026-03-17 11:47:59 -07:00
echo "Build configuration:"
2026-07-11 21:01:58 -07:00
echo " base = $_flag_base"
echo " tag = $_flag_tag"
echo " username = $_flag_username"
echo " email = $_flag_email"
echo " full name = $_flag_full_name"
echo " container runtime = $_flag_runtime"
2026-03-17 11:47:59 -07:00
2026-07-11 21:01:58 -07:00
set -ef no_cache_opt
2026-03-17 11:47:59 -07:00
if set -ql _flag_no_cache
2026-07-11 21:01:58 -07:00
set -f no_cache_opt --no-cache
2026-03-17 11:47:59 -07:00
end
2026-07-11 21:01:58 -07:00
$_flag_runtime build $no_cache_opt -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" \
-f Containerfile \
.