Page History
...
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
#!/bin/bash set -e SCRIPT_HOME=$(dirname "$0") SCRIPT_HOME="`cd "${SCRIPT_HOME}" >/dev/null && pwd`" SCRIPT_FOLDER="`basename $(dirname "$SCRIPT_HOME")`" # ----- modify default settings ----- JS_RELEASE="2.0.0-SNAPSHOT" JS_REPOSITORY="sosberlin/js7" JS_IMAGE="$(basename "${SCRIPT_HOME}")-${JS_RELEASE//\./-}" JS_USER_ID="$UID" JS_HTTP_PORT="4445" JS_HTTPS_PORT= JS_JAVA_OPTIONS="-Xmx500m" JS_BUILD_ARGS= # ----- modify default settings ----- for option in "$@" do case "$option" in --release=*) JS_RELEASE=`echo "$option" | sed 's/--release=//'` ;; --repository=*) JS_REPOSITORY=`echo "$option" | sed 's/--repository=//'` ;; --image=*) JS_IMAGE=`echo "$option" | sed 's/--image=//'` ;; --user-id=*) JS_USER_ID=`echo "$option" | sed 's/--user-id=//'` ;; --http-port=*) JS_HTTP_PORT=`echo "$option" | sed 's/--http-port=//'` ;; --https-port=*) JS_HTTPS_PORT=`echo "$option" | sed 's/--https-port=//'` ;; --java-options=*) JS_JAVA_OPTIONS=`echo "$option" | sed 's/--java-options=//'` ;; --build-args=*) JS_BUILD_ARGS=`echo "$option" | sed 's/--build-args=//'` ;; *) echo "unknown argument: $option" exit 1 ;; esac done set -x docker build --no-cache --rm \ --tag=$JS_REPOSITORY:$JS_IMAGE \ --file=$SCRIPT_HOME/build/Dockerfile \ --build-arg="JS_RELEASE=$JS_RELEASE" \ --build-arg="JS_RELEASE_MAJOR=$(echo $JS_RELEASE | cut -d . -f 1,2)" \ --build-arg="JS_USER_ID=$JS_USER_ID" \ --build-arg="JS_HTTP_PORT=$JS_HTTP_PORT" \ --build-arg="JS_HTTPS_PORT=$JS_HTTPS_PORT" \ --build-arg="JS_JAVA_OPTIONS=$JS_JAVA_OPTIONS" \ $JS_BUILD_ARGS $SCRIPT_HOME/build set +x |
Explanations:
- Line 12 - 2322: Default values are specified that are used if no command line arguments are provided. This includes values for
- the release number: adjust this value to a current the release of JS7 that you want to build an Agent for.
- the repository which by default is
sosberlin:js7
. - the image name is determined from the current folder name and the release number.
- the user id is by default the user id of the user running the build script.
- the Docker network: the build script assumes a Docker network to be used for which a name is specified.the HTTP port and HTTPS port: if the respective port is not specified then the Agent will not listen to a port for the respective protocol. You can for example disable the HTTP protocol by specifying an empty value. The default ports should be fine as they are mapped by the run script to outside ports on the Docker host. However, you can modify ports as you like.
- Java options: typically you would specify default values e.g. for Java memory consumption. The Java options can be overwritten by the run script when starting the container, however, you might want to create your own image with adjusted default values.
- Line 28 27 - 5350: The above options can be overwritten by command line arguments like this:
Code Block language bash title Running the Build Script with Arguments linenumbers true ./build.sh --network=js --http-port=14445 --https-port=14443 --java-options="-Xmx1G"
- Line 57 54 - 6763: The effective
docker build
command is executed with arguments. The Dockerfile is assumed to be located with thebuild
sub-directory of the current directory.
...
Overview
Content Tools