dotfiles/.local/bin/ddev
2025-02-17 06:08:25 +00:00

35 lines
610 B
Bash
Executable File

#!/bin/bash
function dkr() {
local ep="$1"; shift
(set -x
podman run --rm -it -v "$PWD:/mnt/" -w /mnt/ --entrypoint "$ep" \
"$img" "$@"
)
}
declare -A aliases=(
[arch]=docker.io/archlinux/archlinux:base
[debian]=docker.io/debian:12-slim
[flutter]=git.gmoker.com/icing/flutter:main
[kaniko]=gcr.io/kaniko-project/executor:debug
)
if [ -z "$1" ]; then
exit 1
fi
if [ -n "${aliases[$1]}" ]; then
img="${aliases[$1]}"
else
img="docker.io/$1"
[[ "$img" == *:* ]] || img+=:latest
fi
shift
dkr bash "$@"
if [ "$?" = 127 ]; then
dkr sh "$@"
fi