Merge pull request #79 into master

48a7b7f client: lib_docker: add 'experimental' build type (Aaron Fiore)
c74a76b client: Dockerfiles: add hledger source build (Aaron Fiore)
This commit is contained in:
2024-07-10 17:12:58 -07:00
3 changed files with 96 additions and 7 deletions

View File

@@ -0,0 +1,44 @@
# docker-finance | modern accounting for the power-user
#
# Copyright (C) 2024 Aaron Fiore (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/>.
#
# hledger (source)
#
USER root
# Remove pre-existing
RUN pacman -Rsc \
hledger \
hledger-ui \
hledger-web \
--noconfirm
# Remove incompatible (need `ghc` via `stack`)
RUN pacman -Rsc \
ghc \
--noconfirm
USER builder
WORKDIR /usr/local/src
RUN git clone --depth=1 https://github.com/simonmichael/hledger
WORKDIR /usr/local/src/hledger
RUN stack update
RUN stack install --resolver="lts-22.28" --install-ghc --local-bin-path=/usr/local/bin
# vim: sw=2 sts=2 si ai et

View File

@@ -0,0 +1,41 @@
# docker-finance | modern accounting for the power-user
#
# Copyright (C) 2024 Aaron Fiore (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/>.
#
# hledger (source)
#
USER root
# Remove pre-existing
RUN apt-get autoremove --purge -y \
hledger \
hledger-ui \
hledger-web
RUN apt-get install -y \
haskell-stack
USER builder
WORKDIR /usr/local/src
RUN git clone --depth=1 https://github.com/simonmichael/hledger
WORKDIR /usr/local/src/hledger
RUN stack update
RUN stack install --resolver="lts-22.28" --install-ghc --local-bin-path=/usr/local/bin
# vim: sw=2 sts=2 si ai et

View File

@@ -122,7 +122,7 @@ function lib_docker::__parse_args_build()
Build type:
type${global_arg_delim_2}<default|slim|tiny|micro>
type${global_arg_delim_2}<default|slim|tiny|micro|experimental>
\e[32mNotes:\e[0m
@@ -131,17 +131,20 @@ function lib_docker::__parse_args_build()
\e[32mExamples:\e[0m
\e[37;2m# Build normal (default) image\e[0m
\e[37;2m# Build normal 'default' image\e[0m
$ $global_usage type${global_arg_delim_2}default
\e[37;2m# Build a smaller default image but *without* ROOT.cern (meta-analysis) support\e[0m
\e[37;2m# Build a smaller 'default' image but *without* ROOT.cern (meta-analysis) support\e[0m
$ $global_usage type${global_arg_delim_2}slim
\e[37;2m# Build an even smaller default image with *pre-built* hledger-flow binary (but *with* ROOT.cern support)\e[0m
\e[37;2m# Build an even smaller 'default' image with *pre-built* hledger-flow binary (but *with* ROOT.cern support)\e[0m
$ $global_usage type${global_arg_delim_2}tiny
\e[37;2m# Build the smallest image possible: the 'tiny' image *without* ROOT.cern support\e[0m
$ $global_usage type${global_arg_delim_2}micro
\e[37;2m# Build experimental image based on 'default' image (WARNING: large image and possibly unstable)\e[0m
$ $global_usage type${global_arg_delim_2}experimental
"
;;
dev-tools)
@@ -198,7 +201,7 @@ function lib_docker::__parse_args_build()
# Arg: type
if [ ! -z "$_arg_type" ]; then
[[ ! "$_arg_type" =~ ^default$|^slim$|^tiny$|^micro$ ]] \
[[ ! "$_arg_type" =~ ^default$|^slim$|^tiny$|^micro$|^experimental$ ]] \
&& lib_utils::die_usage "$_usage"
declare -gr global_arg_type="$_arg_type"
@@ -243,9 +246,10 @@ function lib_docker::__build()
local _in_files=()
case "$global_arg_type" in
default | slim)
default | slim | experimental)
_in_files+=("hledger-flow.src")
[[ "$global_arg_type" == "default" ]] && _in_files+=("root")
[[ "$global_arg_type" =~ ^default$|^experimental$ ]] && _in_files+=("root")
[[ "$global_arg_type" =~ ^experimental$ ]] && _in_files+=("hledger.src")
;;
tiny | micro)
_in_files+=("hledger-flow.bin")