The exec command tells bash to do the same thing done by the execve() syscall -- to replace its own process table entry with the program being run.
By nature, this operation means that the script is no longer running when complete. If you don't want that, just take out the exec prefixes.
(Also, there's absolutely no reason to use wait here at all; wait only has any effect whatever if a process is backgrounded, and you aren't backgrounding anything).
That said, you might consider using subshells to scope the cd operations -- and then exec will replace only the subshell's process, not the parent; it's not strictly necessary even in that case, but is a slight performance optimization (likewise, replacing #!/bin/bash with #!/bin/sh is a performance improvement on platforms providing a lightweight /bin/sh since you aren't using any bash-only features):
#!/bin/sh
(cd dockerfiles/nginx && exec docker build -t nginx .)
(cd dockerfiles/percona && exec docker build -t percona .)
(cd dockerfiles/memcache && exec docker build -t memcache .)
(cd dockerfiles/sphinx && exec docker build -t sphinx .)
(cd dockerfiles && exec docker build -t php .)
docker-compose up