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

update to new images

parent 2a197dda
No related branches found
No related tags found
2 merge requests!743Production Release | nshmp-haz,!741Docker Images
...@@ -14,13 +14,13 @@ ...@@ -14,13 +14,13 @@
# - RETURN_PERIOD: The return period, used in certian programs # - RETURN_PERIOD: The return period, used in certian programs
# #
# Volumes: # Volumes:
# - Model: /app/model # - Model: /model
# - Output: /app/output # - Output: /output
# #
# docker run \ # docker run \
# --env CLASS_NAME="nshmp-haz class name" \ # --env CLASS_NAME="nshmp-haz class name" \
# --volume "/path/to/model:/app/model" \ # --volume "/path/to/model:/model" \
# --volume "/path/to/output:/app/output" \ # --volume "/path/to/output:/output" \
# usgs/nshmp-haz:production-latest # usgs/nshmp-haz:production-latest
# #
# Build locally: # Build locally:
...@@ -39,8 +39,6 @@ FROM ${BUILD_IMAGE} as builder ...@@ -39,8 +39,6 @@ FROM ${BUILD_IMAGE} as builder
ARG CI_PROJECT_URL=null ARG CI_PROJECT_URL=null
ARG CI_COMMIT_BRANCH=null ARG CI_COMMIT_BRANCH=null
WORKDIR /app
COPY . . COPY . .
RUN ./gradlew assemble RUN ./gradlew assemble
...@@ -57,19 +55,17 @@ ENV CLASS_NAME "HazardCalc" ...@@ -57,19 +55,17 @@ ENV CLASS_NAME "HazardCalc"
ENV IML "" ENV IML ""
ENV RETURN_PERIOD "" ENV RETURN_PERIOD ""
ENV CONFIG_FILE "/app/config.json" ENV CONFIG_FILE "/config.json"
ENV JAVA_MEMORY "8g" ENV JAVA_MEMORY "8g"
ENV MODEL_PATH "/app/model" ENV MODEL_PATH "/model"
ENV OUTPUT_PATH "/app/output" ENV OUTPUT_PATH "/output"
VOLUME [ "${MODEL_PATH}", "${OUTPUT_PATH}" ] VOLUME [ "${MODEL_PATH}", "${OUTPUT_PATH}" ]
WORKDIR /app COPY --from=builder build/libs/nshmp-haz.jar .
COPY --from=builder /app/build/libs/nshmp-haz.jar .
COPY scripts scripts COPY scripts scripts
RUN apit-get install -y jq \ RUN apt-get install -y jq \
&& echo "{}" > "${CONFIG_FILE}" && echo "{}" > "${CONFIG_FILE}"
ENTRYPOINT [ "bash", "scripts/docker-entrypoint.sh" ] ENTRYPOINT [ "bash", "scripts/docker-entrypoint.sh" ]
...@@ -42,9 +42,9 @@ docker run \ ...@@ -42,9 +42,9 @@ docker run \
--env CLASS_NAME=<DisaggCalc | HazardCalc | RateCalc> \ --env CLASS_NAME=<DisaggCalc | HazardCalc | RateCalc> \
--env IML=<NUMBER> \ --env IML=<NUMBER> \
--env RETURN_PERIOD=<NUMBER> \ --env RETURN_PERIOD=<NUMBER> \
--volume /absolute/path/to/sites/file:/app/sites.<geojson | csv> \ --volume /absolute/path/to/sites/file:/sites.<geojson | csv> \
--volume /absolute/path/to/config/file:/app/config.json \ --volume /absolute/path/to/config/file:/config.json \
--volume /absolute/path/to/output:/app/output \ --volume /absolute/path/to/output:/output \
usgs/nshmp-haz usgs/nshmp-haz
``` ```
...@@ -54,16 +54,16 @@ Where: ...@@ -54,16 +54,16 @@ Where:
* [DisaggCalc](../../src/main/java/gov/usgs/earthquake/nshmp/DisaggCalc.java) * [DisaggCalc](../../src/main/java/gov/usgs/earthquake/nshmp/DisaggCalc.java)
* [HazardCalc](../../src/main/java/gov/usgs/earthquake/nshmp/HazardCalc.java) * [HazardCalc](../../src/main/java/gov/usgs/earthquake/nshmp/HazardCalc.java)
* [RateCalc](../../src/main/java/gov/usgs/earthquake/nshmp/RateCalc.java) * [RateCalc](../../src/main/java/gov/usgs/earthquake/nshmp/RateCalc.java)
* Other arguments (local files mapped to files within the Docker container with `:/app/...`): * Other arguments (local files mapped to files within the Docker container):
* (required) The absolute path to a [USGS model (NSHM)](./USGS-Models.md) * (required) The absolute path to a [USGS model (NSHM)](./USGS-Models.md)
* Example: `$(pwd)/nshm-hawaii:/app/model` * Example: `$(pwd)/nshm-hawaii:/model`
* (required) The absolute path to a GeoJSON or CSV [site(s)](./Site-Specification.md) file * (required) The absolute path to a GeoJSON or CSV [site(s)](./Site-Specification.md) file
* CSV example: `$(pwd)/my-csv-sites.csv:/app/sites.csv` * CSV example: `$(pwd)/my-csv-sites.csv:/sites.csv`
* GeoJSON example: `$(pwd)/my-geojson-sites.geojson:/app/sites.geojson` * GeoJSON example: `$(pwd)/my-geojson-sites.geojson:/sites.geojson`
* (required) The absolute path to an output directory * (required) The absolute path to an output directory
* Example: `$(pwd)/my-hazard-output:/app/output` * Example: `$(pwd)/my-hazard-output:/output`
* (optional) The absolute path to a [configuration](./Calculation-Configuration.md) file * (optional) The absolute path to a [configuration](./Calculation-Configuration.md) file
* Example: `$(pwd)/my-custom-config.json:/app/config.json` * Example: `$(pwd)/my-custom-config.json:/config.json`
## Examples ## Examples
...@@ -83,9 +83,9 @@ docker pull usgs/nshmp-haz:latest ...@@ -83,9 +83,9 @@ docker pull usgs/nshmp-haz:latest
# Run nshmp-haz HazardCalc # Run nshmp-haz HazardCalc
docker run \ docker run \
--env CLASS_NAME="HazardCalc" \ --env CLASS_NAME="HazardCalc" \
--volume "$(pwd)/nshm-hawaii:/app/model" \ --volume "$(pwd)/nshm-hawaii:/model" \
--volume "$(pwd)/sites.geojson" \ --volume "$(pwd)/sites.geojson" \
--volume "$(pwd)/hawaii-hazard-output:/app/output" \ --volume "$(pwd)/hawaii-hazard-output:/output" \
usgs/nshmp-haz usgs/nshmp-haz
``` ```
...@@ -106,9 +106,9 @@ docker pull usgs/nshmp-haz:latest ...@@ -106,9 +106,9 @@ docker pull usgs/nshmp-haz:latest
docker run \ docker run \
--env CLASS_NAME="DisaggCalc" \ --env CLASS_NAME="DisaggCalc" \
--env RETURN_PERIOD=475 \ --env RETURN_PERIOD=475 \
--volume "$(pwd)/nshm-hawaii:/app/model" \ --volume "$(pwd)/nshm-hawaii:/model" \
--volume "$(pwd)/sites.geojson" \ --volume "$(pwd)/sites.geojson" \
--volume "$(pwd)/hawaii-disagg-output:/app/output" \ --volume "$(pwd)/hawaii-disagg-output:/output" \
usgs/nshmp-haz:latest usgs/nshmp-haz:latest
``` ```
...@@ -128,9 +128,9 @@ docker pull usgs/nshmp-haz:latest ...@@ -128,9 +128,9 @@ docker pull usgs/nshmp-haz:latest
# Run nshmp-haz RateCalc # Run nshmp-haz RateCalc
docker run \ docker run \
--env CLASS_NAME="RateCalc" \ --env CLASS_NAME="RateCalc" \
--volume "$(pwd)/nshm-hawaii:/app/model" \ --volume "$(pwd)/nshm-hawaii:/model" \
--volume "$(pwd)/sites.geojson" \ --volume "$(pwd)/sites.geojson" \
--volume "$(pwd)/hawaii-rate-output:/app/output" \ --volume "$(pwd)/hawaii-rate-output:/output" \
usgs/nshmp-haz usgs/nshmp-haz
``` ```
......
...@@ -5,11 +5,11 @@ ...@@ -5,11 +5,11 @@
## ##
main() { main() {
# Get name of sites file # Get name of sites file
sites_file=$(ls /app/sites.*); sites_file=$(ls /sites.*);
# Run nshmp-haz # Run nshmp-haz
java "-Xmx${JAVA_MEMORY}" \ java "-Xmx${JAVA_MEMORY}" \
-cp "/app/nshmp-haz.jar" \ -cp "/nshmp-haz.jar" \
"gov.usgs.earthquake.nshmp.${CLASS_NAME}" \ "gov.usgs.earthquake.nshmp.${CLASS_NAME}" \
"${MODEL_PATH}" \ "${MODEL_PATH}" \
"${sites_file}" \ "${sites_file}" \
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
# #
# Run locally: # Run locally:
# docker run -p 8080:8080 # docker run -p 8080:8080
# -v "path/to/models:/models" # -v "path/to/model:/model"
# nshmp-haz-ws # nshmp-haz-ws
#### ####
...@@ -31,8 +31,6 @@ ARG builder_workdir ...@@ -31,8 +31,6 @@ ARG builder_workdir
ARG CI_PROJECT_URL=null ARG CI_PROJECT_URL=null
ARG CI_COMMIT_BRANCH=null ARG CI_COMMIT_BRANCH=null
WORKDIR /app
COPY . . COPY . .
RUN ./gradlew assemble RUN ./gradlew assemble
...@@ -48,10 +46,8 @@ ENV CONTEXT_PATH="/" ...@@ -48,10 +46,8 @@ ENV CONTEXT_PATH="/"
ENV JAVA_OPTS="-Xms2g -Xmx8g" ENV JAVA_OPTS="-Xms2g -Xmx8g"
ENV MODELS_DIRECTORY="/model" ENV MODELS_DIRECTORY="/model"
WORKDIR /app COPY --from=builder build/libs/nshmp-haz.jar .
COPY --from=builder nshms.yml .
COPY --from=builder /app/build/libs/nshmp-haz.jar .
COPY --from=builder /app/nshms.yml .
VOLUME [ "${MODELS_DIRECTORY}" ] VOLUME [ "${MODELS_DIRECTORY}" ]
......
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