summaryrefslogtreecommitdiffstats
path: root/local/.bin/reply
diff options
context:
space:
mode:
Diffstat (limited to 'local/.bin/reply')
-rwxr-xr-xlocal/.bin/reply28
1 files changed, 23 insertions, 5 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 "$@"