Skip to content
Snippets Groups Projects
Commit e026cafc authored by Clayton, Brandon Scott's avatar Clayton, Brandon Scott
Browse files

update to images

parent c640fa9c
No related branches found
No related tags found
2 merge requests!743Production Release | nshmp-haz,!741Docker Images
......@@ -14,8 +14,8 @@
# - RETURN_PERIOD: The return period, used in certian programs
#
# Volumes:
# - Model: /model
# - Output: /output
# - Model: /app/model
# - Output: /app/output
#
# docker run \
# --env CLASS_NAME="nshmp-haz class name" \
......@@ -39,9 +39,13 @@ FROM ${BUILD_IMAGE} as builder
ARG CI_PROJECT_URL=null
ARG CI_COMMIT_BRANCH=null
WORKDIR /app
COPY . .
USER root
RUN ./gradlew assemble
USER usgs-user
####
# Application image: Run jar file.
......@@ -55,14 +59,16 @@ ENV CLASS_NAME "HazardCalc"
ENV IML ""
ENV RETURN_PERIOD ""
ENV CONFIG_FILE "/config.json"
ENV CONFIG_FILE "/app/config.json"
ENV JAVA_MEMORY "8g"
ENV MODEL_PATH "/model"
ENV OUTPUT_PATH "/output"
ENV MODEL_PATH "/app/model"
ENV OUTPUT_PATH "/app/output"
VOLUME [ "${MODEL_PATH}", "${OUTPUT_PATH}" ]
COPY --from=builder build/libs/nshmp-haz.jar .
WORKDIR /app
COPY --from=builder /app/build/libs/nshmp-haz.jar .
COPY scripts scripts
RUN apt-get install -y jq \
......
......@@ -42,9 +42,9 @@ docker run \
--env CLASS_NAME=<DisaggCalc | HazardCalc | RateCalc> \
--env IML=<NUMBER> \
--env RETURN_PERIOD=<NUMBER> \
--volume /absolute/path/to/sites/file:/sites.<geojson | csv> \
--volume /absolute/path/to/config/file:/config.json \
--volume /absolute/path/to/output:/output \
--volume /absolute/path/to/sites/file:/app/sites.<geojson | csv> \
--volume /absolute/path/to/config/file:/app/config.json \
--volume /absolute/path/to/output:/app/output \
usgs/nshmp-haz
```
......@@ -54,16 +54,16 @@ Where:
* [DisaggCalc](../../src/main/java/gov/usgs/earthquake/nshmp/DisaggCalc.java)
* [HazardCalc](../../src/main/java/gov/usgs/earthquake/nshmp/HazardCalc.java)
* [RateCalc](../../src/main/java/gov/usgs/earthquake/nshmp/RateCalc.java)
* Other arguments (local files mapped to files within the Docker container):
* Other arguments (local files mapped to files within the Docker container with `:/app/...`):
* (required) The absolute path to a [USGS model (NSHM)](./USGS-Models.md)
* Example: `$(pwd)/nshm-hawaii:/model`
* Example: `$(pwd)/nshm-hawaii:/app/model`
* (required) The absolute path to a GeoJSON or CSV [site(s)](./Site-Specification.md) file
* CSV example: `$(pwd)/my-csv-sites.csv:/sites.csv`
* GeoJSON example: `$(pwd)/my-geojson-sites.geojson:/sites.geojson`
* CSV example: `$(pwd)/my-csv-sites.csv:/app/sites.csv`
* GeoJSON example: `$(pwd)/my-geojson-sites.geojson:/app/sites.geojson`
* (required) The absolute path to an output directory
* Example: `$(pwd)/my-hazard-output:/output`
* Example: `$(pwd)/my-hazard-output:/app/output`
* (optional) The absolute path to a [configuration](./Calculation-Configuration.md) file
* Example: `$(pwd)/my-custom-config.json:/config.json`
* Example: `$(pwd)/my-custom-config.json:/app/config.json`
## Examples
......@@ -83,9 +83,9 @@ docker pull usgs/nshmp-haz:latest
# Run nshmp-haz HazardCalc
docker run \
--env CLASS_NAME="HazardCalc" \
--volume "$(pwd)/nshm-hawaii:/model" \
--volume "$(pwd)/nshm-hawaii:/app/model" \
--volume "$(pwd)/sites.geojson" \
--volume "$(pwd)/hawaii-hazard-output:/output" \
--volume "$(pwd)/hawaii-hazard-output:/app/output" \
usgs/nshmp-haz
```
......@@ -106,9 +106,9 @@ docker pull usgs/nshmp-haz:latest
docker run \
--env CLASS_NAME="DisaggCalc" \
--env RETURN_PERIOD=475 \
--volume "$(pwd)/nshm-hawaii:/model" \
--volume "$(pwd)/nshm-hawaii:/app/model" \
--volume "$(pwd)/sites.geojson" \
--volume "$(pwd)/hawaii-disagg-output:/output" \
--volume "$(pwd)/hawaii-disagg-output:/app/output" \
usgs/nshmp-haz:latest
```
......@@ -128,9 +128,9 @@ docker pull usgs/nshmp-haz:latest
# Run nshmp-haz RateCalc
docker run \
--env CLASS_NAME="RateCalc" \
--volume "$(pwd)/nshm-hawaii:/model" \
--volume "$(pwd)/nshm-hawaii:/app/model" \
--volume "$(pwd)/sites.geojson" \
--volume "$(pwd)/hawaii-rate-output:/output" \
--volume "$(pwd)/hawaii-rate-output:/app/output" \
usgs/nshmp-haz
```
......
......@@ -5,11 +5,11 @@
##
main() {
# Get name of sites file
sites_file=$(ls /sites.*);
sites_file=$(ls /app/sites.*);
# Run nshmp-haz
java "-Xmx${JAVA_MEMORY}" \
-cp "/nshmp-haz.jar" \
-cp "/app/nshmp-haz.jar" \
"gov.usgs.earthquake.nshmp.${CLASS_NAME}" \
"${MODEL_PATH}" \
"${sites_file}" \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment