Add dtool

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2018-10-22 22:19:40 +02:00
parent f2b45b57e2
commit d81bd6e56d
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E
3 changed files with 43 additions and 0 deletions

View file

@ -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"]

View file

@ -0,0 +1,8 @@
FROM alpine:3.8
ARG UID=1000
RUN set -ex \
&& adduser -u $UID -D work \
&& apk add --no-update imagemagick

26
bin/dtool Executable file
View file

@ -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}" "$@"