diff --git a/server/Makefile b/server/Makefile index c02c50d..2dd387b 100644 --- a/server/Makefile +++ b/server/Makefile @@ -27,12 +27,16 @@ build: go build -o build/planner-agent-ui ./cmd # Image -image: - podman build -t $(IMAGE_REGISTRY)/$(REGISTRY_NAMESPACE)/planner-agent-ui:$(IMAGE_TAG) . +build-image: + scripts/container-wrapper.sh build -t $(IMAGE_REGISTRY)/$(REGISTRY_NAMESPACE)/planner-agent-ui:$(IMAGE_TAG) . # Run image +.ONESHELL: run-image: - podman run -it -p 8443:8443 $(IMAGE_REGISTRY)/$(REGISTRY_NAMESPACE)/planner-agent-ui:$(IMAGE_TAG) + scripts/container-wrapper.sh run -it \ + --name planner-agent-ui \ + -p 8443:8443 \ + $(IMAGE_REGISTRY)/$(REGISTRY_NAMESPACE)/planner-agent-ui:$(IMAGE_TAG) # Run run: build diff --git a/server/scripts/container-wrapper.sh b/server/scripts/container-wrapper.sh new file mode 100755 index 0000000..6abd4d3 --- /dev/null +++ b/server/scripts/container-wrapper.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +command_exists() { + command -v "$1" >/dev/null 2>&1 +} + +# Determine which container runtime to use +if command_exists podman; then + CONTAINER_RUNTIME="podman" +elif command_exists docker; then + CONTAINER_RUNTIME="docker" +else + echo "Neither Podman nor Docker is installed. Please install one of them to proceed." + exit 1 +fi + +# Print the selected container runtime +#echo "Using $CONTAINER_RUNTIME as the container runtime." + +$CONTAINER_RUNTIME "$@" diff --git a/server/generate_mock_ca.sh b/server/scripts/generate_mock_ca.sh similarity index 100% rename from server/generate_mock_ca.sh rename to server/scripts/generate_mock_ca.sh