Single gitlab - identify and build selectively

please guide me

We have a single gitlab cicd pipeline which build multiple docker image (I know it’s a unique structure). Let’s assume for some reason, we have this single to buld multiple docker images in individual stages. But would like to identify code changes and build only that docker build. (and skip other two docker build)

thanks in advance