add ability to publish range of ports

Closes #8899
Signed-off-by: Srini Brahmaroutu <srbrahma@us.ibm.com>
I prefer `ports == ""` as checking for empty strings. This matters not much here, but in larger function this can be confusing.