dotfiles/.local/bin/ddev
2025-06-20 04:36:33 +00:00

34 lines
560 B
Bash
Executable File

#!/bin/bash -e
dkr() {
local shell="$1"; shift
(set -x
podman run --rm -it -v "$PWD:/mnt/" -w /mnt/ --entrypoint "$shell" \
"$img" "$@"
)
}
declare -A aliases=(
[arch]=quay.io/archlinux/archlinux:base
[debian]=docker.io/debian:12-slim
[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