diff --git a/Dockerfile b/Dockerfile index c2e3c74af..cd25218cc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,6 +13,19 @@ # -v /absolute/path/to/output:/app/output \ # usgs/nshmp-haz # +# Usage with custom model: +# docker run \ +# -e PROGRAM= \ +# -e ACCESS_VISUALVM= \ +# -e VISUALVM_PORT= \ +# -e VISUALVM_HOSTNAME= \ +# -e MOUNT_MODEL=true \ +# -v /absolute/path/to/model:/app/model \ +# -v /absolute/path/to/sites/file:/app/sites. \ +# -v /absolute/path/to/config/file:/app/config.json \ +# -v /absolute/path/to/output:/app/output \ +# usgs/nshmp-haz +# # Note: Models load as requested. While all supported models are # available, requesting them all will eventually result in an # OutOfMemoryError. Increase -Xmx to -Xmx16g or -Xmx24g, if available. @@ -90,6 +103,9 @@ ENV JAVA_XMX 8g # NSHM ENV MODEL "" +# Whether to mount the model instead of selecting a model +ENV MOUNT_MODEL false + # Program to run: deagg | deagg-epsilon | hazard | rate ENV PROGRAM hazard diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index f4d4a44aa..3c4de3f38 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -56,6 +56,7 @@ readonly USAGE=" # (string) JAVA_XMS - Java initial memory # (string) JAVA_XMX - Java max memory # (string) MODEL - The nshm +# (boolean) MOUNT_MODEL - Whether to mount the model instead of selecting model # (string) PROGRAM - The program to run # (number) RETURN_PERIOD - The return period for deagg # Arguments: @@ -72,8 +73,13 @@ main() { local nshmp_program="${GET_NSHMP_PROGRAM_RETURN}"; # Get model path - get_model_path 2> ${LOG_FILE}; - local nshmp_model_path="${GET_MODEL_PATH_RETURN}"; + local nshmp_model_path=""; + if [ ${MOUNT_MODEL} = true ]; then + nshmp_model_path="model"; + else + get_model_path 2> ${LOG_FILE}; + nshmp_model_path="${GET_MODEL_PATH_RETURN}"; + fi # Check site file check_sites_file 2> ${LOG_FILE};