chore: Add build

This commit is contained in:
Timo Reymann
2023-02-15 13:25:16 +01:00
parent 762ae97a36
commit 3744a220f1
7 changed files with 43 additions and 15 deletions
+18
View File
@@ -0,0 +1,18 @@
FROM golang:1.20-alpine
RUN apk add bash git && \
mkdir -p /opt && \
mkdir -p /workspace && \
addgroup -g 1000 dev && \
adduser -D -u 1000 -G dev dev && \
chown -R dev:dev /workspace /opt
WORKDIR /opt
USER dev
# renovate: datasource=github-releases depName=malscent/bash_bundler
ENV bash_bundler_version="v1.0.2"
RUN go install github.com/malscent/bash_bundler@${bash_bundler_version}
WORKDIR /workspace
COPY --chown=dev:dev ./src /workspace/src
ENTRYPOINT ["/bin/bash", "-c"]
+2
View File
@@ -1 +1,3 @@
.idea/ .idea/
dist/
+13 -4
View File
@@ -8,7 +8,16 @@ lint: ## Lint files with shellcheck
@find src/*.sh -type f -exec "shellcheck" "-x" {} \; @find src/*.sh -type f -exec "shellcheck" "-x" {} \;
generate-docs: ## Build documentation using docker container generate-docs: ## Build documentation using docker container
docker build . -t bash-tui-toolkit/shdoc -f .development/docs/Dockerfile @docker build . -t bash-tui-toolkit/shdoc -f .development/docs/Dockerfile
docker run --rm bash-tui-toolkit/shdoc 'shdoc < logging.sh ' 2>&1 > docs/modules/Logging.md @docker run --rm bash-tui-toolkit/shdoc 'shdoc < logging.sh ' 2>&1 > docs/modules/Logging.md
docker run --rm bash-tui-toolkit/shdoc 'shdoc < prompts.sh ' 2>&1 > docs/modules/Prompts.md @docker run --rm bash-tui-toolkit/shdoc 'shdoc < prompts.sh ' 2>&1 > docs/modules/Prompts.md
docker run --rm bash-tui-toolkit/shdoc 'shdoc < user_feedback.sh ' 2>&1 > docs/modules/User-Feedback.md @docker run --rm bash-tui-toolkit/shdoc 'shdoc < user_feedback.sh ' 2>&1 > docs/modules/User-Feedback.md
build: ## Bundle script to dist folder and remove all comments
@rm -rf dist || true
@mkdir dist/
@docker build . -t bash-tui-toolkit/builder -f .development/build/Dockerfile
@docker run --rm bash-tui-toolkit/builder 'bash_bundler bundle --entry src/main.sh --output /dev/stderr' 2> dist/bundle.sh
@sed -i '/^$$/d' dist/bundle.sh
@sed -i '/^#/d' dist/bundle.sh
+1 -1
View File
@@ -7,7 +7,7 @@
{ {
"fileMatch": ["Dockerfile$"], "fileMatch": ["Dockerfile$"],
"matchStrings": [ "matchStrings": [
"datasource=(?<datasource>.*?) depName=(?<depName>.*?)( versioning=(?<versioning>.*?))?\\sARG .*?_VERSION=(?<currentValue>.*)\\s" "datasource=(?<datasource>.*?) depName=(?<depName>.*?)( versioning=(?<versioning>.*?))?\\sARG .*?_version=(?<currentValue>.*)\\s"
], ],
"versioningTemplate": "{{#if versioning}}{{{versioning}}}{{else}}semver{{/if}}" "versioningTemplate": "{{#if versioning}}{{{versioning}}}{{else}}semver{{/if}}"
} }
+3 -6
View File
@@ -1,8 +1,5 @@
#!/bin/bash #!/bin/bash
# shellcheck source=src/prompts.sh source "prompts.sh"
source "${BASH_SOURCE%/*}/prompts.sh" source "user_feedback.sh"
# shellcheck source=src/user_feedback.sh source "logging.sh"
source "${BASH_SOURCE%/*}/user_feedback.sh"
# shellcheck source=src/logging.sh
source "${BASH_SOURCE%/*}/logging.sh"
+3 -3
View File
@@ -24,7 +24,7 @@ _key_input() {
} }
# print new line for empty element in array # print new line for empty element in array
_new_line_foreach_item() { for _ in "${1[@]}"; do echo -en "\n" >&2; done } _new_line_foreach_item() { for _ in $1[@]; do echo -en "\n" >&2; done }
# display prompt text without linebreak # display prompt text without linebreak
_prompt_text() { _prompt_text() {
@@ -108,7 +108,7 @@ list() {
local opts=("${@:2}") local opts=("${@:2}")
local opts_count=$(($# -1)) local opts_count=$(($# -1))
_new_line_foreach_item "${opts[@]}" _new_line_foreach_item "${opts[*]}"
# determine current screen position for overwriting the options # determine current screen position for overwriting the options
local lastrow; lastrow=$(_get_cursor_row) local lastrow; lastrow=$(_get_cursor_row)
@@ -158,7 +158,7 @@ checkbox() {
_prompt_text "$1" _prompt_text "$1"
local opts; opts=("${@:2}") local opts; opts=("${@:2}")
local opts_count; opts_count=$(($# -1)) local opts_count; opts_count=$(($# -1))
_new_line_foreach_item "${opts[@]}" _new_line_foreach_item "${opts[*]}"
# determine current screen position for overwriting the options # determine current screen position for overwriting the options
local lastrow; lastrow=$(_get_cursor_row) local lastrow; lastrow=$(_get_cursor_row)
+3 -1
View File
@@ -2,7 +2,9 @@
# #
# Basic demo of features # Basic demo of features
# #
source src/main.sh cd src
source main.sh
cd -
# #
# UTILS # UTILS