diff options
-rwxr-xr-x | local/.bin/reply | 28 | ||||
-rwxr-xr-x | local/.bin/smt | 23 |
2 files changed, 41 insertions, 10 deletions
diff --git a/local/.bin/reply b/local/.bin/reply index 250a93b..412189f 100755 --- a/local/.bin/reply +++ b/local/.bin/reply @@ -1,10 +1,28 @@ #!/bin/sh set -eu -podman images | grep -q localhost/reply || cat <<EOF | podman build -t reply -f - +DOCKERFILE="$(cat <<EOF FROM docker.io/debian:stable-slim -RUN sed -i 's/stable\/updates/stable-security\/updates/' /etc/apt/sources.list -RUN apt-get update && apt-get install -y --no-install-recommends cpanminus make gcc libreadline-dev -RUN cpanm -n Reply B::Keywords Data::Dump Carp::Always Term::ReadLine::Gnu +RUN apt-get update && apt-get install -y --no-install-recommends \ + cpanminus \ + make \ + gcc \ + libreadline-dev +RUN cpanm -n \ + Reply \ + B::Keywords \ + Data::Dump \ + Carp::Always \ + Term::ReadLine::Gnu EOF -podman run --rm -itv /home/doy/.replyrc:/root/.replyrc reply reply "$@" +)" +IMAGE="$(basename "$0"):$(echo "$DOCKERFILE" | sha256sum | cut -d' ' -f1)" + +if [ -z "$(podman images -q "$IMAGE")" ]; then + echo "$DOCKERFILE" | podman build -t "$IMAGE" -f - . +fi + +podman run --rm -it \ + -v "$HOME"/.replyrc:/root/.replyrc \ + "$IMAGE" \ + reply "$@" diff --git a/local/.bin/smt b/local/.bin/smt index ad3f459..446197d 100755 --- a/local/.bin/smt +++ b/local/.bin/smt @@ -1,9 +1,22 @@ #!/bin/sh set -eu -podman images | grep -q localhost/smt || cat <<EOF | podman build -t smt -f - -FROM docker.io/alpine:latest -RUN apk add perl make -RUN env PERL_MM_USE_DEFAULT=1 perl -MCPAN -e'install Games::SMTNocturne::Demons' +DOCKERFILE="$(cat <<EOF +FROM docker.io/debian:stable-slim +RUN apt-get update && apt-get install -y --no-install-recommends \ + cpanminus \ + make \ + gcc \ + libreadline-dev +RUN cpanm -n Games::SMTNocturne::Demons EOF -podman run --rm smt smt "$@" +)" +IMAGE="$(basename "$0"):$(echo "$DOCKERFILE" | sha256sum | cut -d' ' -f1)" + +if [ -z "$(podman images -q "$IMAGE")" ]; then + echo "$DOCKERFILE" | podman build -t "$IMAGE" -f - . +fi + +podman run --rm -it \ + "$IMAGE" \ + smt "$@" |