Merge pull request #225 into master

b130f223 client: completion: add `update` command (Aaron Fiore)
9eca664d client: docker/lib_docker: add `update` feature (Aaron Fiore)
This commit is contained in:
2025-10-08 13:43:34 -07:00
4 changed files with 54 additions and 18 deletions

View File

@@ -2,7 +2,7 @@
# docker-finance | modern accounting for the power-user # docker-finance | modern accounting for the power-user
# #
# Copyright (C) 2024 Aaron Fiore (Founder, Evergreen Crypto LLC) # Copyright (C) 2024-2025 Aaron Fiore (Founder, Evergreen Crypto LLC)
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -46,7 +46,7 @@ function docker-finance::completion()
mapfile -t _images < <(docker images --format "{{.Repository}}:{{.Tag}}" --filter=reference='docker-finance/*/*:*' | cut -d'/' -f2- | grep $USER) mapfile -t _images < <(docker images --format "{{.Repository}}:{{.Tag}}" --filter=reference='docker-finance/*/*:*' | cut -d'/' -f2- | grep $USER)
declare -r _images declare -r _images
local -r _commands=("gen" "edit" "build" "backup" "rm" "up" "down" "start" "stop" "run" "shell" "version" "license" "linter" "doxygen" "plugins") local -r _commands=("gen" "edit" "build" "update" "backup" "rm" "up" "down" "start" "stop" "run" "shell" "version" "license" "linter" "doxygen" "plugins")
local _reply local _reply
@@ -83,6 +83,9 @@ function docker-finance::completion()
build) build)
mapfile -t _reply < <(compgen -W "help type${global_arg_delim_2}" -- "$_cur") mapfile -t _reply < <(compgen -W "help type${global_arg_delim_2}" -- "$_cur")
;; ;;
update)
mapfile -t _reply < <(compgen -W "help type${global_arg_delim_2}" -- "$_cur")
;;
backup | rm | up | down | start | stop) backup | rm | up | down | start | stop)
# TODO: _currently no-op # TODO: _currently no-op
;; ;;

View File

@@ -65,7 +65,8 @@ function main()
All platforms: All platforms:
build \e[34;3mBuild docker-finance image\e[0m build \e[34;3mBuild a new docker-finance image\e[0m
update \e[34;3mUpdate an existing docker-finance image\e[0m
backup \e[34;3mBackup existing instance image\e[0m backup \e[34;3mBackup existing instance image\e[0m
rm \e[34;3mRemove image, remove network (also stops container, if running)\e[0m rm \e[34;3mRemove image, remove network (also stops container, if running)\e[0m
@@ -178,6 +179,9 @@ function main()
build) build)
lib_docker::build "${@:3}" lib_docker::build "${@:3}"
;; ;;
update)
lib_docker::update "${@:3}"
;;
up) up)
lib_docker::up "${@:3}" lib_docker::up "${@:3}"
;; ;;

View File

@@ -2,7 +2,7 @@
# docker-finance | modern accounting for the power-user # docker-finance | modern accounting for the power-user
# #
# Copyright (C) 2021-2024 Aaron Fiore (Founder, Evergreen Crypto LLC) # Copyright (C) 2021-2025 Aaron Fiore (Founder, Evergreen Crypto LLC)
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -101,6 +101,7 @@ function lib_docker::__parse_args_build()
[ -z "$global_arg_delim_3" ] && lib_utils::die_fatal [ -z "$global_arg_delim_3" ] && lib_utils::die_fatal
[ -z "$global_platform" ] && lib_utils::die_fatal [ -z "$global_platform" ] && lib_utils::die_fatal
[ -z "$global_command" ] && lib_utils::die_fatal
# Re-seat global usage for tag options # Re-seat global usage for tag options
local _global_usage local _global_usage
@@ -111,7 +112,7 @@ function lib_docker::__parse_args_build()
local -r _usage=" local -r _usage="
\e[32mDescription:\e[0m \e[32mDescription:\e[0m
Build 'finance' image of given type $global_command 'finance' image of given type
\e[32mUsage:\e[0m \e[32mUsage:\e[0m
@@ -119,27 +120,27 @@ function lib_docker::__parse_args_build()
\e[32mArguments:\e[0m \e[32mArguments:\e[0m
Build type: Image type:
type${global_arg_delim_2}<default|slim|tiny|micro> type${global_arg_delim_2}<default|slim|tiny|micro>
\e[32mExamples:\e[0m \e[32mExamples:\e[0m
\e[37;2m# Build the latest 'default' image, tag as 'default'\e[0m \e[37;2m# $global_command the latest 'default' image, tagged as 'default'\e[0m
$ $_global_usage:default type${global_arg_delim_2}default $ ${_global_usage}:default $global_command type${global_arg_delim_2}default
\e[37;2m# Build the latest 'default' image *without* 'root' module (ROOT.cern), tag as 'slim'\e[0m \e[37;2m# $global_command the latest 'default' image *without* 'root' module (ROOT.cern), tagged as 'slim'\e[0m
$ $_global_usage:slim type${global_arg_delim_2}slim $ ${_global_usage}:slim $global_command type${global_arg_delim_2}slim
\e[37;2m# Build the latest 'slim' image *without* 'fetch' module (remote APIs), tag as 'tiny'\e[0m \e[37;2m# $global_command the latest 'slim' image *without* 'fetch' module (remote APIs), tagged as 'tiny'\e[0m
$ $_global_usage:tiny type${global_arg_delim_2}tiny $ ${_global_usage}:tiny $global_command type${global_arg_delim_2}tiny
\e[37;2m# Build the latest 'tiny' image *without* 'track' support (time, metadata), tag as 'micro'\e[0m \e[37;2m# $global_command the latest 'tiny' image *without* 'track' support (time, metadata), tagged as 'micro'\e[0m
$ $_global_usage:micro type${global_arg_delim_2}micro $ ${_global_usage}:micro $global_command type${global_arg_delim_2}micro
\e[32mNotes:\e[0m \e[32mNotes:\e[0m
- Image tags are not connected to build type - Image tags are *not* connected to build type
(e.g., you can have an 'experimental' tag with a 'micro' image) (e.g., you can have an 'experimental' tag with a 'micro' image)
- All builds will continue to append your custom Dockerfile (see \`edit help\`) - All builds will continue to append your custom Dockerfile (see \`edit help\`)
@@ -167,8 +168,8 @@ function lib_docker::__parse_args_build()
\e[32mExamples:\e[0m \e[32mExamples:\e[0m
\e[37;2m# Build the latest 'default' image, tag as default\e[0m \e[37;2m# $global_command the latest 'default' image (tagged as default\e[0m
$ $_global_usage:default type${global_arg_delim_2}default $ ${_global_usage}:default $global_command type${global_arg_delim_2}default
" "
;; ;;
*) *)
@@ -326,7 +327,25 @@ function lib_docker::__build()
# Execute # Execute
# #
time lib_docker::__docker_compose build --pull docker-finance local _build_args=()
case "$global_command" in
build)
_build_args+=("--pull")
;;
update)
_build_args+=("--pull" "--no-cache")
;;
*)
lib_utils::die_fatal "not implemented"
;;
esac
time lib_docker::__docker_compose build "${_build_args[@]}" docker-finance
}
function lib_docker::__update()
{
# A wrapper to build (which should simply rebuild without cache)
lib_docker::__build "$@"
} }
function lib_docker::__up() function lib_docker::__up()

View File

@@ -138,6 +138,16 @@ function lib_docker::build()
lib_utils::catch $? lib_utils::catch $?
} }
#
# Update docker-finance image
#
function lib_docker::update()
{
lib_docker::__update "$@"
lib_utils::catch $?
}
# #
# Bring up docker-finance services # Bring up docker-finance services
# #