Merge pull request #61 into master
51ef36bclient: Dockerfiles: dev-tools: add `version` dependency (Aaron Fiore)dddd8a9client: lib_docker: add CLI `version` for all platforms (Aaron Fiore)
This commit was merged in pull request #61.
This commit is contained in:
@@ -82,6 +82,20 @@ RUN chown -R :wheel /usr/local/lib/php && chmod g+rwx /usr/local/lib/php
|
||||
# Doxygen
|
||||
RUN apt install -y doxygen graphviz
|
||||
|
||||
#
|
||||
# Client-side `version` command
|
||||
#
|
||||
|
||||
RUN apt install -y pipx
|
||||
|
||||
USER @DOCKER_FINANCE_USER@
|
||||
WORKDIR /home/@DOCKER_FINANCE_USER@
|
||||
|
||||
RUN pipx install shyaml
|
||||
RUN echo "export PATH=\"\$PATH:\${HOME}/.local/bin\"" | tee -a ~/.bash_aliases
|
||||
|
||||
USER root
|
||||
|
||||
#
|
||||
# Entrypoint
|
||||
#
|
||||
|
||||
137
client/docker-finance.yaml
Normal file
137
client/docker-finance.yaml
Normal file
@@ -0,0 +1,137 @@
|
||||
# docker-finance | modern accounting for the power-user
|
||||
#
|
||||
# Copyright (C) 2024 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
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#
|
||||
# docker-finance client/container manifest
|
||||
#
|
||||
|
||||
# `docker-finance` release version
|
||||
# TODO: internal refactor to pull from here
|
||||
version: "1.0.0"
|
||||
|
||||
# Container dependencies (used by `version` command)
|
||||
# NOTE: this must stay inline with Dockerfiles
|
||||
container:
|
||||
archlinux:
|
||||
finance:
|
||||
system:
|
||||
packages:
|
||||
- "coreutils"
|
||||
- "bash"
|
||||
- "gawk"
|
||||
- "sed"
|
||||
commands:
|
||||
base:
|
||||
packages:
|
||||
- "bc"
|
||||
- "composer"
|
||||
- "ghc"
|
||||
- "git"
|
||||
- "hledger-iadd"
|
||||
- "hledger-ui"
|
||||
- "hledger-web"
|
||||
- "hledger"
|
||||
- "python-pipx"
|
||||
- "stack"
|
||||
- "vim"
|
||||
- "visidata"
|
||||
- "xsv"
|
||||
commands:
|
||||
- "csvstat --version"
|
||||
- "hledger-flow --version"
|
||||
- "shyaml --version"
|
||||
fetch:
|
||||
packages:
|
||||
commands:
|
||||
- "php --version | head -n1"
|
||||
- "cat /usr/local/lib/php/composer.json"
|
||||
root:
|
||||
packages:
|
||||
- "benchmark"
|
||||
- "botan2"
|
||||
- "crypto++"
|
||||
- "gtest"
|
||||
- "libsodium"
|
||||
- "root"
|
||||
commands:
|
||||
ubuntu:
|
||||
finance:
|
||||
system:
|
||||
packages:
|
||||
- "coreutils"
|
||||
- "bash"
|
||||
- "gawk"
|
||||
- "sed"
|
||||
commands:
|
||||
base:
|
||||
packages:
|
||||
- "bc"
|
||||
- "cargo"
|
||||
- "composer"
|
||||
- "ghc"
|
||||
- "git"
|
||||
- "haskell-stack"
|
||||
- "hledger-ui"
|
||||
- "hledger-web"
|
||||
- "hledger"
|
||||
- "pipx"
|
||||
- "vim"
|
||||
- "visidata"
|
||||
- "zlib1g-dev"
|
||||
commands:
|
||||
- "xsv --version"
|
||||
- "csvstat --version"
|
||||
- "hledger-flow --version"
|
||||
- "shyaml --version"
|
||||
fetch:
|
||||
packages:
|
||||
commands:
|
||||
- "php --version | head -n1"
|
||||
- "cat /usr/local/lib/php/composer.json"
|
||||
dev-tools:
|
||||
system:
|
||||
packages:
|
||||
- "coreutils"
|
||||
- "bash"
|
||||
commands:
|
||||
linters:
|
||||
packages:
|
||||
# Bash
|
||||
- "bash"
|
||||
- "shfmt"
|
||||
- "shellcheck"
|
||||
# C++
|
||||
- "clang-format"
|
||||
- "cppcheck"
|
||||
- "cpplint"
|
||||
# PHP
|
||||
- "composer"
|
||||
commands:
|
||||
- "php-cs-fixer --version --no-ansi"
|
||||
- "phpstan --version --no-ansi"
|
||||
fetch:
|
||||
packages:
|
||||
commands:
|
||||
- "php --version | head -n1"
|
||||
- "cat /usr/local/lib/php/composer.json"
|
||||
misc:
|
||||
packages:
|
||||
- "doxygen"
|
||||
- "graphviz"
|
||||
commands:
|
||||
|
||||
# vim: sw=2 sts=2 si ai et
|
||||
@@ -71,6 +71,8 @@ function main()
|
||||
run \e[34;3mSpawn a container with given command (container removed on exit)\e[0m
|
||||
shell \e[34;3mOpen shell into running container\e[0m
|
||||
|
||||
version \e[34;3mPrint current version of 'docker-finance' and its dependencies\e[0m
|
||||
|
||||
Dev-tools platform:
|
||||
|
||||
license \e[34;3mAdd a license to a docker-finance file\e[0m
|
||||
@@ -112,6 +114,9 @@ function main()
|
||||
\e[37;2m# Backup image, delete old image, build new image\e[0m
|
||||
$ docker-finance backup && docker-finance rm && docker-finance build
|
||||
|
||||
\e[37;2m# Print current version of 'docker-finance' and client/container ('finance') dependencies\e[0m
|
||||
$ docker-finance version
|
||||
|
||||
\e[37;2m#\e[0m
|
||||
\e[37;2m# Dev-tools platform\e[0m
|
||||
\e[37;2m#\e[0m
|
||||
@@ -130,6 +135,9 @@ function main()
|
||||
|
||||
\e[37;2m# Generate Doxygen for docker-finance source\e[0m
|
||||
$ docker-finance_dev-tools doxygen gen
|
||||
|
||||
\e[37;2m# Print current version of 'docker-finance' and client/container ('dev-tools') dependencies\e[0m
|
||||
$ docker-finance_dev-tools version
|
||||
"
|
||||
|
||||
#
|
||||
@@ -186,6 +194,9 @@ function main()
|
||||
doxygen)
|
||||
lib_docker::doxygen "${@:3}"
|
||||
;;
|
||||
version)
|
||||
lib_docker::version "${@:3}"
|
||||
;;
|
||||
*)
|
||||
lib_utils::die_usage "$_usage"
|
||||
;;
|
||||
|
||||
@@ -320,4 +320,94 @@ function lib_docker::__edit()
|
||||
$EDITOR "${_paths[@]}"
|
||||
}
|
||||
|
||||
function lib_docker::__version()
|
||||
{
|
||||
[ -z "${DOCKER_FINANCE_VERSION}" ] && lib_utils::die_fatal
|
||||
[ -z "${DOCKER_FINANCE_CLIENT_REPO}" ] && lib_utils::die_fatal
|
||||
|
||||
#
|
||||
# `docker-finance` version
|
||||
#
|
||||
|
||||
local _hash
|
||||
if pushd "$DOCKER_FINANCE_CLIENT_REPO" 1>/dev/null; then
|
||||
_hash="$(git log --pretty='format:%h' -n 1)"
|
||||
popd 1>/dev/null || lib_utils::die_fatal
|
||||
else
|
||||
lib_utils::die_fatal
|
||||
fi
|
||||
|
||||
echo
|
||||
echo -e "docker-finance v${DOCKER_FINANCE_VERSION} | commit: $_hash"
|
||||
echo -e "───────────────────────────────────────"
|
||||
|
||||
#
|
||||
# Client dependencies
|
||||
#
|
||||
|
||||
echo
|
||||
echo "client.system:"
|
||||
|
||||
echo -e \\t"$(uname -rmo)"
|
||||
echo -e \\t"$(bash --version | head -n1)"
|
||||
echo -e \\t"$(sed --version | head -n1)"
|
||||
|
||||
echo
|
||||
echo "client.docker:"
|
||||
|
||||
echo -e \\t"$(docker compose version)"
|
||||
docker version \
|
||||
| while read _line; do
|
||||
echo -e \\t"${_line}"
|
||||
done
|
||||
|
||||
#
|
||||
# Container dependencies
|
||||
#
|
||||
|
||||
[ -z "$global_platform" ] && lib_utils::die_fatal
|
||||
|
||||
# Feed dependency manifest (client is not bind-mounted for security reasons)
|
||||
local _manifest
|
||||
_manifest="$(<${DOCKER_FINANCE_CLIENT_REPO}/client/docker-finance.yaml)"
|
||||
|
||||
case "$global_platform" in
|
||||
# NOTE: uses variable "callback"
|
||||
archlinux)
|
||||
_platform="$global_platform"
|
||||
_image="finance"
|
||||
_pkg="pacman -Q \$_package"
|
||||
;;
|
||||
ubuntu | dev-tools)
|
||||
if [[ "$global_platform" =~ ^ubuntu$|^dev-tools$ ]]; then
|
||||
_platform="ubuntu"
|
||||
_image="finance"
|
||||
[[ "$global_platform" == "dev-tools" ]] && _image="dev-tools"
|
||||
fi
|
||||
_pkg="dpkg -s \$_package | grep -E \"(^Package:|^Version:)\" | cut -d' ' -f2 | paste -s | awk '{print \$1 \" \" \$2}'"
|
||||
;;
|
||||
*)
|
||||
lib_utils::die_fatal "unsupported platform"
|
||||
;;
|
||||
esac
|
||||
|
||||
lib_docker::__run "
|
||||
echo '${_manifest}' \\
|
||||
| shyaml keys container.${_platform}.${_image} \\
|
||||
| while read _key; do
|
||||
echo -e \\\ncontainer.${_platform}.${_image}.\${_key}:
|
||||
echo '${_manifest}' | shyaml get-values container.${_platform}.${_image}.\${_key}.packages 2>/dev/null \\
|
||||
| while read _package; do
|
||||
echo -e \\\t\$($_pkg)
|
||||
done
|
||||
echo '${_manifest}' | shyaml get-values container.${_platform}.${_image}.\${_key}.commands 2>/dev/null \\
|
||||
| while read _command; do
|
||||
echo -e \\\t\$(\$_command)
|
||||
done
|
||||
done
|
||||
echo"
|
||||
|
||||
return $?
|
||||
}
|
||||
|
||||
# vim: sw=2 sts=2 si ai et
|
||||
|
||||
@@ -309,4 +309,14 @@ function lib_docker::doxygen()
|
||||
lib_utils::catch $?
|
||||
}
|
||||
|
||||
#
|
||||
# Prints `docker-finance` version (and dependencies' version)
|
||||
#
|
||||
|
||||
function lib_docker::version()
|
||||
{
|
||||
lib_docker::__version "$@"
|
||||
lib_utils::catch $?
|
||||
}
|
||||
|
||||
# vim: sw=2 sts=2 si ai et
|
||||
|
||||
Reference in New Issue
Block a user