From de32b2cffd25efc1e81456c2b2924ec938aa7895 Mon Sep 17 00:00:00 2001 From: Brandon Clayton <bclayton@usgs.gov> Date: Wed, 10 Mar 2021 16:27:45 -0700 Subject: [PATCH] add docker entrypoint --- docker-entrypoint.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 docker-entrypoint.sh diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh new file mode 100644 index 0000000..2f3d8b3 --- /dev/null +++ b/docker-entrypoint.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +INSTALL_DATABASE="${INSTALL_DATABASE:-false}"; +NETCDF_FILE="${NETCDF_FILE:-"/app/data.nc"}"; +NSHM="${NSHM:-"CONUS_2018A"}"; +PROJECT="${PROJECT:-nshmp-netcdf}"; + +# TODO: Remove option to install database in container when deployed to AWS +if [ "${INSTALL_DATABASE}" == "true" ]; then + source "{$HOME}"/.poetry/env; + poetry install; + + case "${NSHM}" in + "CONUS_2018A") + poetry run netcdf \ + --2018A \ + --clean-ascii \ + --database-directory="/app/DATA" \ + --netcdf-filename="${NETCDF_FILE}"; + ;; + *) + printf "ERROR: NSHM %s not supported" "${NSHM}"; + ;; + esac +fi + +/usr/bin/java -jar "${PROJECT}.jar" \ + "-Dmicronaut.server.context-path=${CONTEXT_PATH}" \ + -nshm="${NSHM}" \ + -netcdf="${NETCDF_FILE}"; -- GitLab