summaryrefslogtreecommitdiffstats
path: root/bin/.bin/reply
blob: 412189f44c689ce17673292bc593a7f52f9111fc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/sh
set -eu

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 \
  Reply \
  B::Keywords \
  Data::Dump \
  Carp::Always \
  Term::ReadLine::Gnu
EOF
)"
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 "$@"