forked from EvergreenCrypto/docker-finance
client: docker/lib_docker: add update feature
Simply rebuilds image without cache because modules are built locally (meaning, there's no "newer version" image of modules to pull against).
This commit is contained in:
@@ -65,7 +65,8 @@ function main()
|
||||
|
||||
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
|
||||
rm \e[34;3mRemove image, remove network (also stops container, if running)\e[0m
|
||||
|
||||
@@ -178,6 +179,9 @@ function main()
|
||||
build)
|
||||
lib_docker::build "${@:3}"
|
||||
;;
|
||||
update)
|
||||
lib_docker::update "${@:3}"
|
||||
;;
|
||||
up)
|
||||
lib_docker::up "${@:3}"
|
||||
;;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# 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
|
||||
# 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_platform" ] && lib_utils::die_fatal
|
||||
[ -z "$global_command" ] && lib_utils::die_fatal
|
||||
|
||||
# Re-seat global usage for tag options
|
||||
local _global_usage
|
||||
@@ -111,7 +112,7 @@ function lib_docker::__parse_args_build()
|
||||
local -r _usage="
|
||||
\e[32mDescription:\e[0m
|
||||
|
||||
Build 'finance' image of given type
|
||||
$global_command 'finance' image of given type
|
||||
|
||||
\e[32mUsage:\e[0m
|
||||
|
||||
@@ -119,27 +120,27 @@ function lib_docker::__parse_args_build()
|
||||
|
||||
\e[32mArguments:\e[0m
|
||||
|
||||
Build type:
|
||||
Image type:
|
||||
|
||||
type${global_arg_delim_2}<default|slim|tiny|micro>
|
||||
|
||||
\e[32mExamples:\e[0m
|
||||
|
||||
\e[37;2m# Build the latest 'default' image, tag as 'default'\e[0m
|
||||
$ $_global_usage:default type${global_arg_delim_2}default
|
||||
\e[37;2m# $global_command the latest 'default' image, tagged as 'default'\e[0m
|
||||
$ ${_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
|
||||
$ $_global_usage:slim type${global_arg_delim_2}slim
|
||||
\e[37;2m# $global_command the latest 'default' image *without* 'root' module (ROOT.cern), tagged as 'slim'\e[0m
|
||||
$ ${_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
|
||||
$ $_global_usage:tiny type${global_arg_delim_2}tiny
|
||||
\e[37;2m# $global_command the latest 'slim' image *without* 'fetch' module (remote APIs), tagged as 'tiny'\e[0m
|
||||
$ ${_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
|
||||
$ $_global_usage:micro type${global_arg_delim_2}micro
|
||||
\e[37;2m# $global_command the latest 'tiny' image *without* 'track' support (time, metadata), tagged as 'micro'\e[0m
|
||||
$ ${_global_usage}:micro $global_command type${global_arg_delim_2}micro
|
||||
|
||||
\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)
|
||||
|
||||
- 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[37;2m# Build the latest 'default' image, tag as default\e[0m
|
||||
$ $_global_usage:default type${global_arg_delim_2}default
|
||||
\e[37;2m# $global_command the latest 'default' image (tagged as default\e[0m
|
||||
$ ${_global_usage}:default $global_command type${global_arg_delim_2}default
|
||||
"
|
||||
;;
|
||||
*)
|
||||
@@ -326,7 +327,25 @@ function lib_docker::__build()
|
||||
# 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()
|
||||
|
||||
@@ -138,6 +138,16 @@ function lib_docker::build()
|
||||
lib_utils::catch $?
|
||||
}
|
||||
|
||||
#
|
||||
# Update docker-finance image
|
||||
#
|
||||
|
||||
function lib_docker::update()
|
||||
{
|
||||
lib_docker::__update "$@"
|
||||
lib_utils::catch $?
|
||||
}
|
||||
|
||||
#
|
||||
# Bring up docker-finance services
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user