mv dockerfile port logic to common function + tests. closes #1280

This commit is contained in:
Michael Hobbs
2015-07-12 15:56:52 -07:00
parent 5f8b2d291c
commit ee4fca572e
4 changed files with 38 additions and 1 deletions

View File

@@ -201,3 +201,12 @@ get_container_ids() {
shopt -u nullglob
echo $DOKKU_CIDS
}
get_dockerfile_exposed_port() {
local DOCKERFILE_PORT=$(grep "^EXPOSE \+[[:digit:]]\+\(\/tcp\)\? *$" $1 | head -1 | sed 's/EXPOSE \+\([[:digit:]]\+\)\(\/tcp\)\?.*/\1/' || true)
if [[ -n "$DOCKERFILE_PORT" ]]; then
echo "$DOCKERFILE_PORT"
else
echo ""
fi
}