diff --git a/.config/dtool/ffmpeg/Dockerfile b/.config/dtool/ffmpeg/Dockerfile new file mode 100644 index 0000000..00ac0ce --- /dev/null +++ b/.config/dtool/ffmpeg/Dockerfile @@ -0,0 +1,9 @@ +FROM alpine:3.8 + +ARG UID=1000 + +RUN set -ex \ + && adduser -u $UID -D work \ + && apk add --no-update ffmpeg + +ENTRYPOINT ["ffmpeg"] diff --git a/.config/dtool/imagick/Dockerfile b/.config/dtool/imagick/Dockerfile new file mode 100644 index 0000000..7fd7865 --- /dev/null +++ b/.config/dtool/imagick/Dockerfile @@ -0,0 +1,8 @@ +FROM alpine:3.8 + +ARG UID=1000 + +RUN set -ex \ + && adduser -u $UID -D work \ + && apk add --no-update imagemagick + diff --git a/bin/dtool b/bin/dtool new file mode 100755 index 0000000..3b35ea2 --- /dev/null +++ b/bin/dtool @@ -0,0 +1,26 @@ +#!/bin/bash +set -euo pipefail + +source ${HOME}/bin/script_framework.sh + +[ $# -lt 1 ] && fail "At least the tool must be specified" + +TOOL=$1 +shift + +toolimage="dtool.local/${TOOL}" + +docker images | grep -q "^${toolimage}" || { + step "Building tool image for \"${TOOL}\"" + toolpath="${HOME}/.config/dtool/${TOOL}" + docker build -q \ + -t "${toolimage}" \ + --build-arg UID=$(id -u) \ + "${toolpath}" +} + +step "Executing \"${toolimage} $@\"..." +exec docker run --rm -ti \ + -u $(id -u) \ + -v "$(pwd):$(pwd)" -w "$(pwd)" \ + "${toolimage}" "$@"