#!/bin/sh -e
#
# pod-build-run - build and run a podman image

TAG="$(xxd -l2 -ps /dev/urandom)"
echo "${TAG}" | pbcopy

# shellcheck disable=SC2312
if podman build --file "$(fd Dockerfile | fzf --select-1 | head -n 1)" --tag "${TAG}" .; then
  podman run "$@" --interactive --tty "${TAG}"
fi
