#!/bin/bash
source "$(dirname "$0")/_common.sh"

# Required environment variables
check_required_env_vars "CONTAINER_NAME" "IMAGE_REGISTRY" "IMAGE_REPO" "IMAGE_TAG"

_remove_container $CONTAINER_NAME || die "Failed to remove container ${CONTAINER_NAME}"

# remove the image
docker rmi "$IMAGE_REGISTRY/$IMAGE_REPO:$IMAGE_TAG" || echo "Failed to remove image $IMAGE_REGISTRY/$IMAGE_REPO:$IMAGE_TAG"

echo "Uninstallation of ${CONTAINER_NAME} complete."

