Support publishing exposed container ports on custom host ports
Change-Id: I3dcd47932821a124906f8d125697ecbe21c259af
Issue-ID: OOM-2605
Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
diff --git a/build/build_nexus_blob.sh b/build/build_nexus_blob.sh
index 47190d0..004528d 100755
--- a/build/build_nexus_blob.sh
+++ b/build/build_nexus_blob.sh
@@ -38,8 +38,10 @@
# Nexus repository properties
NEXUS_DOMAIN="nexus"
NEXUS_HOST="127.0.0.1"
-NEXUS_PORT="8081"
-NEXUS_DOCKER_PORT="8082"
+NEXUS_EXPOSED_PORT="8081"
+NEXUS_PORT=${NEXUS_EXPOSED_PORT}
+NEXUS_DOCKER_EXPOSED_PORT="8082"
+NEXUS_DOCKER_PORT=${NEXUS_DOCKER_EXPOSED_PORT}
DEFAULT_REGISTRY="docker.io"
# Nexus repository credentials
@@ -96,6 +98,8 @@
-p | --pypi use specific list of pypi packages to be pushed into Nexus
-rl | --resource-list-directory use specific directory with docker, pypi and npm lists
-c | --container-name use specific Nexus docker container name
+ -NP | --nexus-port use specific port for published Nexus service
+ -DP | --docker-port use specific port for published Nexus docker registry port
"
exit 1
}
@@ -223,6 +227,12 @@
-rl | --resource-list-directory ) shift
LISTS_DIR="$(realpath ${1})"
;;
+ -NP | --nexus-port ) shift
+ NEXUS_PORT="${1}"
+ ;;
+ -DP | --docker-port ) shift
+ NEXUS_DOCKER_PORT="${1}"
+ ;;
-h | --help ) usage
;;
*) usage
@@ -276,7 +286,7 @@
fi
# Setup default ports published to host as docker registry
-PUBLISHED_PORTS="-p ${NEXUS_PORT}:${NEXUS_PORT} -p ${NEXUS_DOCKER_PORT}:${NEXUS_DOCKER_PORT}"
+PUBLISHED_PORTS="-p ${NEXUS_PORT}:${NEXUS_EXPOSED_PORT} -p ${NEXUS_DOCKER_PORT}:${NEXUS_DOCKER_EXPOSED_PORT}"
# Nexus repository configuration setup
NEXUS_CONFIG_GROOVY='import org.sonatype.nexus.security.realm.RealmManager