Skip to content

Commit

Permalink
Improved Docker-related documentation.
Browse files Browse the repository at this point in the history
Also introduced new Docker image versioning.
  • Loading branch information
matejak committed Mar 18, 2018
1 parent 3ecb82a commit 5ea0135
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
3 changes: 3 additions & 0 deletions docker/README.md
Expand Up @@ -43,6 +43,9 @@ A container is created from the `matejak/argbash` image.
* The `-e PROGRAM=argbash` option is redundant and it basically affirms the container to invoke `argbash`. If you specify `PROGRAM=argbash-init`, `argbash-init` will be invoked instead, default program is `argbash`.
* The `-v ...:/work` mounts the current directory to the working directory of the container, which is `/work`.
* The `"$@"` or `%*` propagates any arguments given to this one-liner script to the `argbash` invocation in the container.
Make sure that you use the `-o|--output` option - if you intend to use the Argbash output from stdout, the line endings will be of the DOS kind (i.e. `\r\n` instead of just `\n` - thanks to [Filip Filmar](https://github.com/filmil) who found this out).

Note that as the container mounts the host directory, you may have issues with SELinux or similar measures enforcing proactive security.


Example
Expand Down
15 changes: 15 additions & 0 deletions docker/entrypoint.sh
Expand Up @@ -3,4 +3,19 @@
LAUNCH="argbash"
test "$PROGRAM" = 'argbash-init' && LAUNCH="argbash-init" || true

encountered_output_option=no
for arg in "$@"; do
if printf "%s" "$arg" | grep -q -e '^\(-o\|--output\)\>'; then
encountered_output_option=yes
break
fi
done

"${LAUNCH}" "$@"

if test "$encountered_output_option" != yes; then
echo '# It seems that you use the output to stdout.' >&2
echo '# Beware, docker is likely to change line endings to DOS line endings.' >&2
echo '# This will make the script not executable on Unixes, unless you convert \r\n to \n' >&2
echo '# Use the -o|--output option to save the output to a file.' >&2
fi
2 changes: 1 addition & 1 deletion docker/handle_image.sh
Expand Up @@ -4,7 +4,7 @@ set -e

version="$(cat ../src/version)"

another_tag="matejak/argbash:$version"
another_tag="matejak/argbash:$version-${pkgrel:-1}"
another_tag_option=(-t "$another_tag")
dest="$version.tar.gz"

Expand Down

0 comments on commit 5ea0135

Please sign in to comment.