dev allow specifying tag

This commit is contained in:
Tomas Mirchev 2025-03-03 13:38:03 +01:00
parent c119e3fce5
commit a976ea3861

View File

@ -13,8 +13,9 @@ usage() {
while getopts ":i:" opt; do
case ${opt} in
i )
IMAGE="${OPTARG}" # User-provided image (without registry)
FULL_IMAGE_NAME="${REGISTRY}/${IMAGE}" # Full registry image path
IFS=':' read -r IMAGE IMAGE_TAG <<< "${OPTARG}" # Split image and tag
IMAGE_TAG=${IMAGE_TAG:-latest} # Default to 'latest' if no tag is provided
FULL_IMAGE_NAME="${REGISTRY}/${OPTARG}" # Keep the full image name with tag
;;
\? )
usage
@ -29,7 +30,7 @@ if [ -z "$FULL_IMAGE_NAME" ] || [ -z "$1" ]; then
fi
NAME="$1"
CONTAINER_NAME="${IMAGE}-${NAME}"
CONTAINER_NAME="${IMAGE##*/}-${NAME}" # Use only the base image name (without tag)
exec_into_container() {
docker exec --detach-keys "ctrl-q,ctrl-p" -it "$CONTAINER_NAME" bash -c "tmux new -A -s $NAME"
@ -61,3 +62,4 @@ fi
echo "Executing into container $CONTAINER_NAME..."
exec_into_container