ttcn3.sh: build_testsuite: build docker img first
diff --git a/ttcn3/ttcn3.sh b/ttcn3/ttcn3.sh
index 698e3f6..dc90c3c 100755
--- a/ttcn3/ttcn3.sh
+++ b/ttcn3/ttcn3.sh
@@ -12,6 +12,7 @@
 # be based on the same distribution that master-* containers are based on, so
 # there are no incompatibilities with shared libraries.
 DOCKER_IMG_BUILD="debian-bullseye-build"
+DOCKER_IMG_TITAN="debian-bullseye-titan"
 
 check_usage() {
 	local name="$(basename $0)"
@@ -249,6 +250,10 @@
 	done
 }
 
+docker_image_exists() {
+	test -n "$(docker images -q "$1")"
+}
+
 build_testsuite() {
 	cd "$(get_testsuite_dir)"
 
@@ -266,6 +271,18 @@
 	local testsuite_image="$(get_testsuite_image)"
 	echo "testsuite_image: $testsuite_image"
 
+	if ! docker_image_exists "$testsuite_image"; then
+		if ! docker_image_exists "$USER/$DOCKER_IMG_TITAN"; then
+			echo "Building docker image: $USER/$DOCKER_IMG_TITAN"
+			local dp="${DIR_OSMODEV}/src/docker-playground"
+			make -C "$dp/$DOCKER_IMG_TITAN"
+		fi
+
+		echo "Building docker image: $testsuite_image"
+		local testsuite_dir="$(get_testsuite_dir_docker)"
+		make -C "$testsuite_dir"
+	fi
+
 	# -t: add a tty, so we get color output from the compiler
 	docker run \
 		--rm \